64 lines
2.2 KiB
PHP
64 lines
2.2 KiB
PHP
<?php
|
|
namespace app\controllers\channel;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Yii;
|
|
use app\models\common\Store;
|
|
use app\models\common\Config;
|
|
use app\models\common\Delivery;
|
|
class DeliveryController extends CommonController{
|
|
public $enableCsrfValidation = false;
|
|
private $shop_id;
|
|
function init(){
|
|
parent::init();
|
|
$this->shop_id=$this->storeId?:Store::getMainStore($this->wqData['uniacid'])['id'];
|
|
$this->shop_id=$this->shop_id?:0;
|
|
}
|
|
public function actionAddOrder()
|
|
{
|
|
$module=$this->wqData['module'];
|
|
$post=axios_request();
|
|
$order=(new \yii\db\Query())
|
|
->from('{{%ybwm_takeout_order}}')
|
|
->where('id=:id',[':id'=>$post['id']])->one();
|
|
if($order['deliveryMode']==2){
|
|
$result= Delivery::addDataOrder($order,$module);
|
|
}elseif ($order['deliveryMode']==3){
|
|
$result= Delivery::addDianwodaOrder($order);
|
|
}elseif ($order['deliveryMode']==4){
|
|
$result= Delivery::makeCancelOrder($order,$module);
|
|
}elseif ($order['deliveryMode']==5){
|
|
$result= Delivery::sftcAddOrder($order);
|
|
}elseif ($order['deliveryMode']==7){
|
|
$result= Delivery::sanAddOrder($order);
|
|
}elseif ($order['deliveryMode']==11){
|
|
$result= Delivery::addKeloopOrder($order);
|
|
}elseif ($order['deliveryMode']==12){
|
|
$result= Delivery::addUuptOrder($order);
|
|
}
|
|
if($result=='success'){
|
|
return $this->result(1,'操作成功');
|
|
}else{
|
|
return $this->result(2,$result);
|
|
}
|
|
}
|
|
public function actionCancelOrder()
|
|
{
|
|
$module=$this->wqData['module'];
|
|
$post=axios_request();
|
|
$order=(new \yii\db\Query())
|
|
->from('{{%ybwm_takeout_order}}')
|
|
->where('id=:id',[':id'=>$post['id']])->one();
|
|
if($order['deliveryMode']==2){
|
|
$result= Delivery::cancelDataOrder($post['id'],$module);
|
|
}elseif ($order['deliveryMode']==7){
|
|
$result= Delivery::cancelSanOrder($post['id']);
|
|
}
|
|
if($result=='success'){
|
|
return $this->result(1,'操作成功');
|
|
}else{
|
|
return $this->result(2,$result);
|
|
}
|
|
// var_dump($result);die;
|
|
}
|
|
|
|
} |