添加收银机部分接口
This commit is contained in:
parent
87b4c23e3b
commit
0239ac5440
46
app/api/controller/order/CashierinfoController.php
Normal file
46
app/api/controller/order/CashierinfoController.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller\order;
|
||||
|
||||
|
||||
use app\api\controller\BaseApiController;
|
||||
use app\admin\lists\retail\CashierinfoLists;
|
||||
use app\admin\logic\retail\CashierinfoLogic;
|
||||
use app\admin\validate\retail\CashierinfoValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 零售订单详情控制器
|
||||
* Class CashierinfoController
|
||||
* @package app\admin\controller\retail
|
||||
*/
|
||||
class CashierinfoController extends BaseApiController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取零售订单详情列表
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/04/24 10:11
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new CashierinfoLists());
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取零售订单详情详情
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/04/24 10:11
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new CashierinfoValidate())->goCheck('detail');
|
||||
$result = CashierinfoLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -14,6 +14,7 @@ use app\common\logic\PaymentLogic;
|
||||
use app\common\logic\PayNotifyLogic;
|
||||
use app\common\model\order\Cart;
|
||||
use app\common\model\retail\Cashierclass;
|
||||
use app\common\model\retail\Cashierinfo;
|
||||
use app\common\model\user\User;
|
||||
use app\common\model\user\UserAddress;
|
||||
use app\common\service\wechat\WeChatConfigService;
|
||||
@ -31,6 +32,35 @@ class RetailOrderController extends BaseApiController
|
||||
return $this->dataLists(new RetailOrderList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 收银机对应的采购零售订单列表
|
||||
*/
|
||||
public function merchant_order_list()
|
||||
{
|
||||
$number = $this->request->get('number');
|
||||
$page_no = $this->request->get('page_no', 1);
|
||||
$date = $this->request->get('date', date('Y-m-d'));
|
||||
if(!$this->userInfo['merchant']['mer_id']){
|
||||
return $this->fail('没有权限');
|
||||
}
|
||||
$where=[];
|
||||
if($number){
|
||||
$where[] = ['number', 'like', '%' . $number . '%'];
|
||||
}
|
||||
$where[] = ['merchant', '=',$this->userInfo['merchant']['mer_id']];
|
||||
$where[] = ['paid', '=',1];
|
||||
$res = Cashierclass::where($where)->page($page_no, 25)->whereDay('create_time', $date)
|
||||
->select()->each(function($item){
|
||||
$item['goods_list']=Cashierinfo::where('pid',$item['id'])->with('goodsName')->field('goods,nums,price sell')->limit(5)->select();
|
||||
$item['goods_count']=count(explode(',',$item['cart_id']));
|
||||
});
|
||||
$data['count'] = Cashierclass::where($where)->whereDay('create_time', $date)->count();
|
||||
$data['lists'] = $res?->toArray();
|
||||
$data['page_no'] = $page_no;
|
||||
$data['page_siz'] = 15;
|
||||
return $this->success('ok', $data);
|
||||
}
|
||||
|
||||
public function order_count()
|
||||
{
|
||||
$userId = $this->request->userId;
|
||||
|
@ -6,6 +6,7 @@ use app\api\controller\BaseApiController;
|
||||
use app\api\lists\user\UserAddressList;
|
||||
use app\api\logic\user\AddressLogic;
|
||||
use app\api\validate\UserAddressValidate;
|
||||
use app\common\model\retail\Cashierclass;
|
||||
|
||||
class AddressController extends BaseApiController
|
||||
{
|
||||
@ -29,6 +30,26 @@ class AddressController extends BaseApiController
|
||||
return $this->fail(AddressLogic::getError());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 商户给用户添加地址
|
||||
*/
|
||||
public function merchant_create()
|
||||
{
|
||||
$params = (new UserAddressValidate())->post()->goCheck('add');
|
||||
if($params['order_id'] && $params['order_id']!=0){
|
||||
$uid=Cashierclass::where('id',$params['order_id'])->value('uid');
|
||||
if(!$uid || $uid<=0){
|
||||
return $this->fail('订单不存在');
|
||||
}
|
||||
}
|
||||
$params['uid'] = $uid;
|
||||
$res=AddressLogic::add($params);
|
||||
if($res){
|
||||
return $this->success('添加成功');
|
||||
}else{
|
||||
return $this->fail(AddressLogic::getError());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @notes 编辑地址
|
||||
* @return \think\response\Json
|
||||
|
@ -185,16 +185,16 @@ class OrderLogic extends BaseLogic
|
||||
return false;
|
||||
}
|
||||
$mer_id = $user['merchant']['mer_id'];
|
||||
$merchant = Merchant::where('mer_id', $mer_id)->find();
|
||||
// $merchant = Merchant::where('mer_id', $mer_id)->find();
|
||||
$orderInfo = self::cartIdByPurchaseOrderInfo($user, $params);
|
||||
if (!$orderInfo) {
|
||||
return false;
|
||||
}
|
||||
$_order = $orderInfo['order'];
|
||||
if ($_order['total'] < $merchant['mer_money']) {
|
||||
self::setError('商户余额不足');
|
||||
return false;
|
||||
}
|
||||
// if ($_order['total'] < $merchant['mer_money']) {
|
||||
// self::setError('商户余额不足');
|
||||
// return false;
|
||||
// }
|
||||
$_order['merchant'] = $mer_id;
|
||||
$_order['money'] = $_order['total'];
|
||||
$_order['actual'] = $_order['total'];
|
||||
@ -208,7 +208,7 @@ class OrderLogic extends BaseLogic
|
||||
$goods_list[$k]['nums'] = $v['cart_num'];
|
||||
}
|
||||
(new Opurchaseinfo())->saveAll($goods_list);
|
||||
$merchant->mer_money = bcsub($merchant->mer_money, $_order['total'], 2);
|
||||
// $merchant->mer_money = bcsub($merchant->mer_money, $_order['total'], 2);
|
||||
$order_arr = explode(',', $_order['order_arr']);
|
||||
Cashierclass::where('id', 'in', $order_arr)->update(['is_opurchase' => 1]);
|
||||
Db::commit();
|
||||
|
@ -76,9 +76,9 @@ Route::post(parse_url(config('plugin.webman.push.app.channel_hook'), PHP_URL_PAT
|
||||
|
||||
// 业务根据需要处理上下线的channel,例如将在线状态写入数据库,通知其它channel等
|
||||
// 上线的所有channel
|
||||
echo 'online channels: ' . implode(',', $channels_online) . "\n";
|
||||
// echo 'online channels: ' . implode(',', $channels_online) . "\n";
|
||||
// 下线的所有channel
|
||||
echo 'offline channels: ' . implode(',', $channels_offline) . "\n";
|
||||
// echo 'offline channels: ' . implode(',', $channels_offline) . "\n";
|
||||
|
||||
return 'OK';
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user