feat: 增加支付通知功能

This commit is contained in:
mkm 2024-06-29 16:49:16 +08:00
parent 54bb838ab6
commit 2ae18e951c
2 changed files with 55 additions and 1 deletions

View File

@ -0,0 +1,46 @@
<?php
namespace app\api\controller\user_product_storage;
use app\api\controller\BaseApiController;
use app\admin\lists\user_product_storage\UserProductStorageLists;
use app\common\logic\user_product_storage\UserProductStorageLogic;
/**
* 用户商品储存控制器
* Class UserProductStorageController
* @package app\admin\controller\user_product_storage
*/
class UserProductStorageController extends BaseApiController
{
/**
* @notes 获取用户商品储存列表
* @return \think\response\Json
* @author admin
* @date 2024/06/28 11:05
*/
public function lists()
{
return $this->dataLists(new UserProductStorageLists());
}
/**
* 预约
*/
public function reservation(){
$params=$this->request->post();
$info=$params['info'];
$uid=$this->userId;
$store_id=$params['store_id'];
$times=$params['times'];
UserProductStorageLogic::supply($info,$uid,$store_id,0,$times);
if(UserProductStorageLogic::hasError()){
return $this->fail(UserProductStorageLogic::getError());
}
return $this->success('操作成功');
}
}

View File

@ -39,10 +39,13 @@ class UserProductStorageLogic extends BaseLogic
/** /**
* 出库 * 出库
*/ */
public static function supply($data,$uid,$store_id){ public static function supply($data,$uid,$store_id,$status=1,$times=''){
Db::startTrans(); Db::startTrans();
try { try {
$data_log=[]; $data_log=[];
if($times!=''){
$times=strtotime($times);
}
foreach ($data as $k=>$v){ foreach ($data as $k=>$v){
$find=UserProductStorage::where('uid',$uid)->where('product_id',$v['product_id'])->find(); $find=UserProductStorage::where('uid',$uid)->where('product_id',$v['product_id'])->find();
if($find){ if($find){
@ -62,6 +65,11 @@ class UserProductStorageLogic extends BaseLogic
$data_log[$k]['store_id']=$store_id; $data_log[$k]['store_id']=$store_id;
$data_log[$k]['financial_pm']=0; $data_log[$k]['financial_pm']=0;
$data_log[$k]['nums']=$v['nums']; $data_log[$k]['nums']=$v['nums'];
$data_log[$k]['times']=$times;
$data_log[$k]['status']=$status;
}else{
self::setError('没有查询到该商品');
return false;
} }
} }
(new UserProductStorageLog())->saveAll($data_log); (new UserProductStorageLog())->saveAll($data_log);