核销码查数据
This commit is contained in:
parent
750f54b453
commit
cfed701649
@ -28,6 +28,25 @@ class OrderController extends BaseApiController
|
||||
return $this->dataLists(new OrderList());
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('核销码查数据'),
|
||||
ApiDoc\url('/api/order/order/write_code'),
|
||||
ApiDoc\Method('POST'),
|
||||
ApiDoc\Param(name: "code", type: "string", require: false, desc: "核销码"),
|
||||
ApiDoc\NotHeaders(),
|
||||
ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||
]
|
||||
public function write_code()
|
||||
{
|
||||
$code = $this->request->post('code');
|
||||
if(empty($code)){
|
||||
return $this->fail('缺失参数');
|
||||
}
|
||||
$res = OrderLogic::getOne($code);
|
||||
return $this->success('ok',$res);
|
||||
}
|
||||
|
||||
#[
|
||||
ApiDoc\Title('核销订单列表'),
|
||||
ApiDoc\url('/api/order/order/write_list'),
|
||||
@ -402,8 +421,7 @@ class OrderController extends BaseApiController
|
||||
public function writeoff_order()
|
||||
{
|
||||
$params = (new OrderValidate())->post()->goCheck('check');
|
||||
$userId = $this->request->userId;
|
||||
$res = OrderLogic::writeOff($params,$userId);
|
||||
$res = OrderLogic::writeOff($params);
|
||||
if ($res) {
|
||||
return $this->success('核销成功');
|
||||
}
|
||||
|
@ -436,7 +436,6 @@ class OrderLogic extends BaseLogic
|
||||
|
||||
/**
|
||||
* @param $params
|
||||
* @param $uid
|
||||
* @return bool
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
@ -444,11 +443,10 @@ class OrderLogic extends BaseLogic
|
||||
* @author: codeliu
|
||||
* @Time: 2024/6/3 22:42
|
||||
*/
|
||||
public static function writeOff($params, $uid): bool
|
||||
public static function writeOff($params): bool
|
||||
{
|
||||
$data = StoreOrder::with('store')->where([
|
||||
'verify_code' => $params['verify_code'],
|
||||
'uid' => $uid
|
||||
'verify_code' => $params['verify_code']
|
||||
])->find();
|
||||
if (empty($data)) {
|
||||
return false;
|
||||
@ -520,6 +518,17 @@ class OrderLogic extends BaseLogic
|
||||
|
||||
}
|
||||
|
||||
public static function getOne($code)
|
||||
{
|
||||
return StoreOrder::with(['store'])->where('verify_code',$code)
|
||||
->select()->each(function ($item) {
|
||||
$item['goods_list']=StoreOrderCartInfo::where('oid',$item['id'])->with('goodsName')->field('product_id,cart_num,verify_code,is_writeoff,writeoff_time')->limit(3)->select();
|
||||
$item['goods_count']=count(explode(',',$item['cart_id']));
|
||||
return $item; //返回处理后的数据。
|
||||
})
|
||||
->toArray();
|
||||
|
||||
}
|
||||
|
||||
public static function write_list($info,$status,$params)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user