作者 jinglong
1 个管道 的构建 通过 耗费 5 秒

修改退换货撤销接口

... ... @@ -293,7 +293,7 @@ class Common
$arr['data'] = $res;
//总页数
$arr['total_page'] = Common::countSoft('goods',$where);
$arr['total_page'] = self::countSoft('goods',$where);
if(empty($flag)){
return $arr;
}else{
... ...
... ... @@ -513,7 +513,7 @@ class Orders extends Api
//查询订单
$status = $this->order_status;
$where = ['id'=>$order_id,'uid'=>$this->uid,'status'=>$status[5]];//待收货
$where = ['id'=>$order_id,'uid'=>$this->uid,'status'=>['in',$status[5],$status[8]]];//待收货,已完成
$order = Common::findSoftWhereData('order',$where,'id');
if($order){
$orderModel = new Order();
... ... @@ -544,6 +544,7 @@ class Orders extends Api
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
*
* @ApiParams (name="order_id", type="inter", required=true, description="订单id")
* @ApiParams (name="cancel_flag", type="inter", required=true, description="记录本地缓存的上一个状态(1:原始状态为待收货,2:原始状态为已完成)")
*
* @ApiReturn({
"code": 1,
... ... @@ -555,10 +556,11 @@ class Orders extends Api
public function cancelApplyReturnGoods(){
if($this->request->isGet()){
$order_id = $this->request->get('order_id');
$cancel_flag = $this->request->get('cancel_flag');
$rule = config('verify.order_detail');
$rule = config('verify.return_flag');
$validate = new Validate($rule['rule'],$rule['msg']);
if (!$validate->check(['order_id'=>$order_id])) {
if (!$validate->check(['order_id'=>$order_id,'cancel_flag'=>$cancel_flag])) {
$this->error($validate->getError());
}
... ... @@ -568,7 +570,14 @@ class Orders extends Api
$order = Common::findSoftWhereData('order',$where,'id');
if($order){
$orderModel = new Order();
if($cancel_flag == 1){
$res = $orderModel->where($where)->update(['status'=>$status[5],'return_refund_flag'=>0,'return_reason'=>'']);//待收货
}else if($cancel_flag == 2){
$res = $orderModel->where($where)->update(['status'=>$status[8],'return_refund_flag'=>0,'return_reason'=>'']);//已完成
}else{
$res = false;
}
if($res){
$this->success('撤销成功');
}else{
... ...
... ... @@ -322,4 +322,17 @@ return [
'share_uid.number' => '分享人id必须为数字',
]
],
//申请退换货撤销
'return_flag' => [
'rule' => [
'order_id' => 'require|number',
'cancel_flag' => 'require|number',
],
'msg' => [
'order_id.require' => '订单id不能为空',
'order_id.number' => '订单id必须为数字',
'cancel_flag.require' => '撤销标识不能为空',
'cancel_flag.number' => '撤销标识必须为数字',
]
],
];
\ No newline at end of file
... ...
... ... @@ -5333,6 +5333,12 @@
<td></td>
<td>订单id</td>
</tr>
<tr>
<td>cancel_flag</td>
<td>inter</td>
<td></td>
<td>记录本地缓存的上一个状态(1:原始状态为待收货,2:原始状态为已完成)</td>
</tr>
</tbody>
</table>
</div>
... ... @@ -5367,6 +5373,10 @@
<input type="inter" class="form-control input-sm" id="order_id" required placeholder="订单id" name="order_id">
</div>
<div class="form-group">
<label class="control-label" for="cancel_flag">cancel_flag</label>
<input type="inter" class="form-control input-sm" id="cancel_flag" required placeholder="记录本地缓存的上一个状态(1:原始状态为待收货,2:原始状态为已完成)" name="cancel_flag">
</div>
<div class="form-group">
<button type="submit" class="btn btn-success send" rel="33">提交</button>
<button type="reset" class="btn btn-info" rel="33">重置</button>
</div>
... ... @@ -7490,7 +7500,7 @@
<div class="row mt0 footer">
<div class="col-md-6" align="left">
Generated on 2019-12-10 15:38:45 </div>
Generated on 2019-12-10 17:23:13 </div>
<div class="col-md-6" align="right">
<a href="https://www.fastadmin.net" target="_blank">FastAdmin</a>
</div>
... ...