Merge branch 'main' of https://gitea.lihaink.cn/mkm/multi-store
This commit is contained in:
commit
0de65a8ff5
@ -47,7 +47,6 @@ class StoreOrderCartInfoLists extends BaseAdminDataLists implements ListsSearchI
|
|||||||
return StoreOrderCartInfo::where($this->searchWhere)
|
return StoreOrderCartInfo::where($this->searchWhere)
|
||||||
->field('cart_info,product_id')->limit($this->limitOffset, $this->limitLength)
|
->field('cart_info,product_id')->limit($this->limitOffset, $this->limitLength)
|
||||||
->select()->each(function ($item) {
|
->select()->each(function ($item) {
|
||||||
$item['cart_info'] = json_decode($item['cart_info'], true); //将json字符串转换为数组,方便使用其中的数据。
|
|
||||||
$find=StoreBranchProduct::where('id',$item['product_id'])->field('image,store_name')->find();
|
$find=StoreBranchProduct::where('id',$item['product_id'])->field('image,store_name')->find();
|
||||||
if($find){
|
if($find){
|
||||||
$item['image']=$find['image'];//商品图片
|
$item['image']=$find['image'];//商品图片
|
||||||
|
@ -28,6 +28,25 @@ class OrderController extends BaseApiController
|
|||||||
return $this->dataLists(new OrderList());
|
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\Title('核销订单列表'),
|
||||||
ApiDoc\url('/api/order/order/write_list'),
|
ApiDoc\url('/api/order/order/write_list'),
|
||||||
@ -402,8 +421,7 @@ class OrderController extends BaseApiController
|
|||||||
public function writeoff_order()
|
public function writeoff_order()
|
||||||
{
|
{
|
||||||
$params = (new OrderValidate())->post()->goCheck('check');
|
$params = (new OrderValidate())->post()->goCheck('check');
|
||||||
$userId = $this->request->userId;
|
$res = OrderLogic::writeOff($params);
|
||||||
$res = OrderLogic::writeOff($params,$userId);
|
|
||||||
if ($res) {
|
if ($res) {
|
||||||
return $this->success('核销成功');
|
return $this->success('核销成功');
|
||||||
}
|
}
|
||||||
|
@ -436,7 +436,6 @@ class OrderLogic extends BaseLogic
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $params
|
* @param $params
|
||||||
* @param $uid
|
|
||||||
* @return bool
|
* @return bool
|
||||||
* @throws \think\db\exception\DataNotFoundException
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
* @throws \think\db\exception\DbException
|
* @throws \think\db\exception\DbException
|
||||||
@ -444,11 +443,10 @@ class OrderLogic extends BaseLogic
|
|||||||
* @author: codeliu
|
* @author: codeliu
|
||||||
* @Time: 2024/6/3 22:42
|
* @Time: 2024/6/3 22:42
|
||||||
*/
|
*/
|
||||||
public static function writeOff($params, $uid): bool
|
public static function writeOff($params): bool
|
||||||
{
|
{
|
||||||
$data = StoreOrder::with('store')->where([
|
$data = StoreOrder::with('store')->where([
|
||||||
'verify_code' => $params['verify_code'],
|
'verify_code' => $params['verify_code']
|
||||||
'uid' => $uid
|
|
||||||
])->find();
|
])->find();
|
||||||
if (empty($data)) {
|
if (empty($data)) {
|
||||||
return false;
|
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)
|
public static function write_list($info,$status,$params)
|
||||||
{
|
{
|
||||||
|
@ -7,6 +7,7 @@ use app\common\{logic\BaseLogic,
|
|||||||
model\system_store\SystemStore,
|
model\system_store\SystemStore,
|
||||||
model\user\User,
|
model\user\User,
|
||||||
model\user\UserRecharge,
|
model\user\UserRecharge,
|
||||||
|
model\user\UserShip,
|
||||||
service\wechat\WeChatMnpService};
|
service\wechat\WeChatMnpService};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -59,13 +60,20 @@ class UserLogic extends BaseLogic
|
|||||||
|
|
||||||
public static function info($uid)
|
public static function info($uid)
|
||||||
{
|
{
|
||||||
$data = User::where('id',$uid)
|
$data = User::with(['userShip'])->where('id',$uid)
|
||||||
->field('avatar,real_name,nickname,account,mobile,sex,login_ip,user_money')
|
->field('avatar,real_name,nickname,account,mobile,sex,login_ip,user_money,total_recharge_amount,user_ship')
|
||||||
->find();
|
->find();
|
||||||
|
|
||||||
//判断是不是员工
|
//判断是不是员工
|
||||||
if($data){
|
if($data){
|
||||||
$data = $data->toArray();
|
$data = $data->toArray();
|
||||||
|
$all =UserShip::field('id,title,limit')->select()->toArray();
|
||||||
|
$new = self::getNextArrayByID($all,$data['user_ship']);
|
||||||
|
$data['next_level'] = '';
|
||||||
|
$data['next_limit'] = 0;
|
||||||
|
if($new){
|
||||||
|
$data['next_level'] = $new['title'];
|
||||||
|
$data['next_limit'] = $new['limit'] - $data['total_recharge_amount'];
|
||||||
|
}
|
||||||
$data['is_staff'] = 0;
|
$data['is_staff'] = 0;
|
||||||
$data['store_id'] = 0;
|
$data['store_id'] = 0;
|
||||||
if(isset($data['mobile']) && $data['mobile']){
|
if(isset($data['mobile']) && $data['mobile']){
|
||||||
@ -91,4 +99,22 @@ class UserLogic extends BaseLogic
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function getNextArrayByID($arr, $id) {
|
||||||
|
// 遍历数组
|
||||||
|
foreach ($arr as $key => $value) {
|
||||||
|
// 检查当前数组的id是否与传入的id匹配
|
||||||
|
if ($value['id'] == $id) {
|
||||||
|
// 如果当前数组不是最后一个,则返回下一个数组
|
||||||
|
if ($key + 1 < count($arr)) {
|
||||||
|
return $arr[$key + 1];
|
||||||
|
}
|
||||||
|
// 如果当前数组是最后一个,则返回null或空数组
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 如果没有找到匹配的id,则返回null或空数组
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -34,11 +34,14 @@ class PaymentLogic extends BaseLogic
|
|||||||
{
|
{
|
||||||
// 支付编号-仅为微信支付预置(同一商户号下不同客户端支付需使用唯一订单号)
|
// 支付编号-仅为微信支付预置(同一商户号下不同客户端支付需使用唯一订单号)
|
||||||
$paySn = $order['order_id'];
|
$paySn = $order['order_id'];
|
||||||
if ($order['pay_price'] == 0) {
|
if ($order['pay_price'] === 0) {
|
||||||
PayNotifyLogic::handle($from, $order['order_id']);
|
PayNotifyLogic::handle($from, $order['order_id']);
|
||||||
return ['pay_way' => PayEnum::BALANCE_PAY];
|
return ['pay_way' => PayEnum::BALANCE_PAY];
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
if(isset($order['price'])){
|
||||||
|
$order['pay_price'] = $order['price'];
|
||||||
|
}
|
||||||
switch ($payWay) {
|
switch ($payWay) {
|
||||||
case PayEnum::WECHAT_PAY:
|
case PayEnum::WECHAT_PAY:
|
||||||
$auth = UserAuth::where(['user_id' => $order['uid'], 'terminal' => $terminal])->findOrEmpty();
|
$auth = UserAuth::where(['user_id' => $order['uid'], 'terminal' => $terminal])->findOrEmpty();
|
||||||
|
@ -21,6 +21,13 @@ class User extends BaseModel
|
|||||||
protected $deleteTime = 'delete_time';
|
protected $deleteTime = 'delete_time';
|
||||||
|
|
||||||
|
|
||||||
|
public function userShip()
|
||||||
|
{
|
||||||
|
return $this->hasOne(UserShip::class,'id','user_ship')
|
||||||
|
// return $this->hasOne(UserShip::class,'user_ship','id')
|
||||||
|
->bind(['vip_name'=>'title','discount','limit']);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notes 关联用户授权模型
|
* @notes 关联用户授权模型
|
||||||
* @return \think\model\relation\HasOne
|
* @return \think\model\relation\HasOne
|
||||||
|
Loading…
x
Reference in New Issue
Block a user