123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?php
- class ConfirmController extends CController{
- public $layout="none";
- public function actionPaySuccess(){
- $input_data = json_decode(file_get_contents("php://input"), true);
- $input_data = $input_data['data']['object'];
- if($input_data['object'] == 'charge'&& $input_data['paid']==true){
-
-
- //TODO update database
- $order = ROrder::get(new MongoId($input_data['order_no']));
- if(!$order || $order->status == -1){
- echo 'fail';
- die();
- }
- $order->charge_id = $input_data['id'];
- $order->pay_channel = $input_data['channel'];
- $order->status = 1;
- if($order->update(array('charge_id','pay_channel','status'),true)){
- $list = new ARedisList('o2o_after_pay_success');
- $list->push(json_encode($input_data));
- echo 'success';
- die();
- }else{
- echo 'fail';
- die();
- }
- }elseif($input_data['object'] == 'refund'&& $input_data['succeed']==true){
- //TODO update database
- echo 'success';
- die();
- }else{
- echo 'fail';
- die();
- }
- }
- public function actionCheckMobile(){
- $mobile = Yii::app()->getRequest()->getParam("mobile",'');
- if($mobile && preg_match("/\d{11}/",$mobile)){
- $criteria = new EMongoCriteria();
- $criteria->mobile('==',$mobile);
- $user = Mobile::model()->find($criteria);
- if($user){
- echo 'fail';
- }else{
- $userAr = new Mobile();
- $userAr->mobile = $mobile;
- if($userAr->save()){
- echo 'success';
- }else{
- echo 'fail';
- }
- }
- }else{
- echo 'fail';
- }
- }
- public function actionSyncCode(){
- echo ENVIRONMENT."\n";
- if(ENVIRONMENT == 'product'){
- exec("/data/php/webshell/SyncCodeOnline.sh");
- echo 'success';
- }elseif(ENVIRONMENT == 'develop'){
- exec("/data/php/webshell/SyncCodeDev.sh");
- echo 'success';
- }else{
- exec("/data/php/webshell/SyncCode.sh");
- echo 'success';
- }
- }
- }
|