feat(store): 添加门店会员充值功能
This commit is contained in:
parent
b0bda50449
commit
b6211105c0
@ -55,6 +55,7 @@ class StoreController extends BaseApiController
|
|||||||
'staff_id'=>0,
|
'staff_id'=>0,
|
||||||
'order_id'=>getNewOrderId('CZ'),
|
'order_id'=>getNewOrderId('CZ'),
|
||||||
'price'=>0.01,
|
'price'=>0.01,
|
||||||
|
'recharge_type'=>'INDUSTRYMEMBERS',
|
||||||
];
|
];
|
||||||
$order = UserRecharge::create($data);
|
$order = UserRecharge::create($data);
|
||||||
|
|
||||||
@ -71,4 +72,18 @@ class StoreController extends BaseApiController
|
|||||||
}
|
}
|
||||||
return $this->success('支付成功', ['out_trade_no' => $result['out_trade_no'], 'pay_type' => PayEnum::WECHAT_PAY_BARCODE, 'transaction_id' => $result['transaction_id']]);
|
return $this->success('支付成功', ['out_trade_no' => $result['out_trade_no'], 'pay_type' => PayEnum::WECHAT_PAY_BARCODE, 'transaction_id' => $result['transaction_id']]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 门店会员充值数量
|
||||||
|
*/
|
||||||
|
public function recharge_count()
|
||||||
|
{
|
||||||
|
$store_id = $this->request->get('store_id',0);
|
||||||
|
$count=0;
|
||||||
|
if($store_id){
|
||||||
|
$count= UserRecharge::where(['store_id'=>$store_id,'recharge_type'=>'INDUSTRYMEMBERS','paid'=>1])->count();
|
||||||
|
}
|
||||||
|
return $this->success('ok',['count'=>$count]);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
24
app/api/controller/user/UserRechargeController.php
Normal file
24
app/api/controller/user/UserRechargeController.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\api\controller\user;
|
||||||
|
|
||||||
|
use app\api\lists\user\UserFeedbackLists;
|
||||||
|
use app\api\logic\user\UserFeedbackLogic;
|
||||||
|
use app\admin\validate\user\UserFeedbackValidate;
|
||||||
|
use app\api\controller\BaseApiController;
|
||||||
|
|
||||||
|
|
||||||
|
class UserRechargeController extends BaseApiController
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 获取用户充值
|
||||||
|
* @return \support\Response
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2024/05/13 16:56
|
||||||
|
*/
|
||||||
|
public function lists()
|
||||||
|
{
|
||||||
|
return $this->dataLists(new UserFeedbackLists());
|
||||||
|
}
|
||||||
|
}
|
@ -113,7 +113,7 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface,Li
|
|||||||
if($M_store_id){
|
if($M_store_id){
|
||||||
$where[]=['store_id','=',$M_store_id];
|
$where[]=['store_id','=',$M_store_id];
|
||||||
$data = StoreBranchProduct::where($this->searchWhere)->where($where)
|
$data = StoreBranchProduct::where($this->searchWhere)->where($where)
|
||||||
->field(['id', 'product_id','cate_id','store_name', 'cost','store_id','price', 'bar_code','image','sales','store_info','delete_time','unit'])
|
->field(['id', 'product_id','cate_id','store_name','batch', 'cost','store_id','price', 'bar_code','image','sales','store_info','delete_time','unit'])
|
||||||
->limit($this->limitOffset, $this->limitLength)
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
->with(['className','unitName'])
|
->with(['className','unitName'])
|
||||||
->order($this->sortOrder)
|
->order($this->sortOrder)
|
||||||
@ -122,7 +122,7 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface,Li
|
|||||||
|
|
||||||
}else{
|
}else{
|
||||||
$data = StoreBranchProduct::where($this->searchWhere)->where($where)
|
$data = StoreBranchProduct::where($this->searchWhere)->where($where)
|
||||||
->field(['id', 'product_id','cate_id','store_name','cost', 'store_id','price', 'bar_code','image','sales','store_info','delete_time','unit'])
|
->field(['id', 'product_id','cate_id','store_name','batch','cost', 'store_id','price', 'bar_code','image','sales','store_info','delete_time','unit'])
|
||||||
->limit($this->limitOffset, $this->limitLength)
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
->with(['className','unitName'])
|
->with(['className','unitName'])
|
||||||
->order($this->sortOrder)
|
->order($this->sortOrder)
|
||||||
|
63
app/api/lists/user/UserRechargeLists.php
Normal file
63
app/api/lists/user/UserRechargeLists.php
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\api\lists\user;
|
||||||
|
|
||||||
|
use app\admin\lists\BaseAdminDataLists;
|
||||||
|
use app\common\lists\ListsSearchInterface;
|
||||||
|
use app\common\model\user\User;
|
||||||
|
use app\common\model\user\UserFeedback;
|
||||||
|
use app\common\model\user_recharge\UserRecharge;
|
||||||
|
|
||||||
|
//用户充值表
|
||||||
|
class UserRechargeLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 设置搜索条件
|
||||||
|
* @return \string[][]
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2024/05/13 16:56
|
||||||
|
*/
|
||||||
|
public function setSearch(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'=' => ['store_id','recharge_type'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 获取用户充值表列表
|
||||||
|
* @return array
|
||||||
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
|
* @throws \think\db\exception\DbException
|
||||||
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2024/05/13 16:56
|
||||||
|
*/
|
||||||
|
public function lists(): array
|
||||||
|
{
|
||||||
|
return UserRecharge::where($this->searchWhere)
|
||||||
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
|
->order(['id' => 'desc'])
|
||||||
|
->select()->each(function($data){
|
||||||
|
$user = User::field('nickname')->where('id',$data['uid'])->findOrEmpty();
|
||||||
|
$data['user_name'] = !$user->isEmpty() ? $user['nickname'] : '';
|
||||||
|
})
|
||||||
|
->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 获取用户充值表数量
|
||||||
|
* @return int
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2024/05/13 16:56
|
||||||
|
*/
|
||||||
|
public function count(): int
|
||||||
|
{
|
||||||
|
return UserFeedback::where($this->searchWhere)->count();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -350,6 +350,7 @@ class StoreOrderController extends BaseAdminController
|
|||||||
'staff_id'=>$this->adminId,
|
'staff_id'=>$this->adminId,
|
||||||
'order_id'=>getNewOrderId('CZ'),
|
'order_id'=>getNewOrderId('CZ'),
|
||||||
'price'=>$params['price'],
|
'price'=>$params['price'],
|
||||||
|
'recharge_type'=>'INDUSTRYMEMBERS',
|
||||||
];
|
];
|
||||||
$order = UserRecharge::create($data);
|
$order = UserRecharge::create($data);
|
||||||
$order['pay_price']=$order['price'];
|
$order['pay_price']=$order['price'];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user