This commit is contained in:
mkm 2024-04-27 11:41:34 +08:00
parent d6516e3621
commit 872f27305a
27 changed files with 938 additions and 191 deletions

View File

@ -92,4 +92,12 @@ class GoodsController extends BaseAdminController
}
public function setLabel(){
$params=$this->request->post();
$result = GoodsLogic::setLabel($params);
if (true === $result) {
return $this->success('设置成功', [], 1, 1);
}
return $this->fail(GoodsLogic::getError());
}
}

View File

@ -0,0 +1,95 @@
<?php
namespace app\admin\controller\goods;
use app\admin\controller\BaseAdminController;
use app\admin\lists\goods\GoodsLabelLists;
use app\admin\logic\goods\GoodsLabelLogic;
use app\admin\validate\goods\GoodsLabelValidate;
/**
* 商品标签控制器
* Class GoodsLabelController
* @package app\admin\controller\goods
*/
class GoodsLabelController extends BaseAdminController
{
/**
* @notes 获取商品标签列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/27 09:23
*/
public function lists()
{
return $this->dataLists(new GoodsLabelLists());
}
/**
* @notes 添加商品标签
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/27 09:23
*/
public function add()
{
$params = (new GoodsLabelValidate())->post()->goCheck('add');
$result = GoodsLabelLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(GoodsLabelLogic::getError());
}
/**
* @notes 编辑商品标签
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/27 09:23
*/
public function edit()
{
$params = (new GoodsLabelValidate())->post()->goCheck('edit');
$result = GoodsLabelLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(GoodsLabelLogic::getError());
}
/**
* @notes 删除商品标签
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/27 09:23
*/
public function delete()
{
$params = (new GoodsLabelValidate())->post()->goCheck('delete');
GoodsLabelLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取商品标签详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/27 09:23
*/
public function detail()
{
$params = (new GoodsLabelValidate())->goCheck('detail');
$result = GoodsLabelLogic::detail($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,95 @@
<?php
namespace app\admin\controller\operation;
use app\admin\controller\BaseAdminController;
use app\admin\lists\operation\OpurchaseclassLists;
use app\admin\logic\operation\OpurchaseclassLogic;
use app\admin\validate\operation\OpurchaseclassValidate;
/**
* 采购订单控制器
* Class OpurchaseclassController
* @package app\admin\controller\operation
*/
class OpurchaseclassController extends BaseAdminController
{
/**
* @notes 获取采购订单列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/27 11:26
*/
public function lists()
{
return $this->dataLists(new OpurchaseclassLists());
}
/**
* @notes 添加采购订单
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/27 11:26
*/
public function add()
{
$params = (new OpurchaseclassValidate())->post()->goCheck('add');
$result = OpurchaseclassLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(OpurchaseclassLogic::getError());
}
/**
* @notes 编辑采购订单
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/27 11:26
*/
public function edit()
{
$params = (new OpurchaseclassValidate())->post()->goCheck('edit');
$result = OpurchaseclassLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(OpurchaseclassLogic::getError());
}
/**
* @notes 删除采购订单
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/27 11:26
*/
public function delete()
{
$params = (new OpurchaseclassValidate())->post()->goCheck('delete');
OpurchaseclassLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取采购订单详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/27 11:26
*/
public function detail()
{
$params = (new OpurchaseclassValidate())->goCheck('detail');
$result = OpurchaseclassLogic::detail($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,65 @@
<?php
namespace app\admin\lists\goods;
use app\admin\lists\BaseAdminDataLists;
use app\common\model\goods\GoodsLabel;
use app\common\lists\ListsSearchInterface;
/**
* 商品标签列表
* Class GoodsLabelLists
* @package app\admin\listsgoods
*/
class GoodsLabelLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/04/27 09:23
*/
public function setSearch(): array
{
return [
'=' => ['name'],
];
}
/**
* @notes 获取商品标签列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2024/04/27 09:23
*/
public function lists(): array
{
return GoodsLabel::where($this->searchWhere)
->field(['id', 'name'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
->toArray();
}
/**
* @notes 获取商品标签数量
* @return int
* @author likeadmin
* @date 2024/04/27 09:23
*/
public function count(): int
{
return GoodsLabel::where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,65 @@
<?php
namespace app\admin\lists\operation;
use app\admin\lists\BaseAdminDataLists;
use app\common\model\operation\Opurchaseclass;
use app\common\lists\ListsSearchInterface;
/**
* 采购订单列表
* Class OpurchaseclassLists
* @package app\admin\listsoperation
*/
class OpurchaseclassLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/04/27 11:26
*/
public function setSearch(): array
{
return [
'=' => ['merchant', 'order_arr', 'number'],
];
}
/**
* @notes 获取采购订单列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2024/04/27 11:26
*/
public function lists(): array
{
return Opurchaseclass::where($this->searchWhere)
->field(['id', 'merchant', 'order_arr', 'cart_id', 'number', 'total', 'deduction_price', 'actual', 'money', 'paid'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
->toArray();
}
/**
* @notes 获取采购订单数量
* @return int
* @author likeadmin
* @date 2024/04/27 11:26
*/
public function count(): int
{
return Opurchaseclass::where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,94 @@
<?php
namespace app\admin\logic\goods;
use app\common\model\goods\GoodsLabel;
use app\common\logic\BaseLogic;
use think\facade\Db;
/**
* 商品标签逻辑
* Class GoodsLabelLogic
* @package app\admin\logic\goods
*/
class GoodsLabelLogic extends BaseLogic
{
/**
* @notes 添加商品标签
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/27 09:23
*/
public static function add(array $params): bool
{
Db::startTrans();
try {
GoodsLabel::create([
'name' => $params['name']
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑商品标签
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/27 09:23
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
GoodsLabel::where('id', $params['id'])->update([
'name' => $params['name']
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除商品标签
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/27 09:23
*/
public static function delete(array $params): bool
{
return GoodsLabel::destroy($params['id']);
}
/**
* @notes 获取商品标签详情
* @param $params
* @return array
* @author likeadmin
* @date 2024/04/27 09:23
*/
public static function detail($params): array
{
return GoodsLabel::findOrEmpty($params['id'])->toArray();
}
}

View File

@ -46,7 +46,7 @@ class GoodsLogic extends BaseLogic
'stocktip' => $params['stocktip'],
'retail_name' => $params['retail_name'],
'imgs' => $params['imgs'],
'details' => $params['details']?implode(',',$params['details']):'',
'details' => $params['details'] ? implode(',', $params['details']) : '',
'data' => $params['data'],
'more' => $params['more'],
'sort' => $params['sort']
@ -91,7 +91,7 @@ class GoodsLogic extends BaseLogic
'stocktip' => $params['stocktip'],
'retail_name' => $params['retail_name'],
'imgs' => $params['imgs'],
'details' => $params['details']?implode(',',$params['details']):'',
'details' => $params['details'] ? implode(',', $params['details']) : '',
'data' => $params['data'],
'more' => $params['more'],
'sort' => $params['sort']
@ -131,4 +131,28 @@ class GoodsLogic extends BaseLogic
{
return Goods::findOrEmpty($params['id'])->toArray();
}
}
/**
* @notes 设置标签
* @param $params
* @return bool
* @date 2024/04/23 11:28
*/
public static function setLabel($params)
{
try {
$value = $params['sys_labels'];
if (!empty($value)) {
if (!is_array($value)){
$value= ',' . $value . ',';
}else{
$value = ',' . implode(',', $value) . ',';
}
}
Goods::where('id', $params['id'])->update(['sys_labels' => $value]);
return true;
} catch (\Exception $e) {
self::setError($e->getMessage());
return false;
}
}
}

View File

@ -0,0 +1,94 @@
<?php
namespace app\admin\logic\operation;
use app\common\model\operation\Opurchaseclass;
use app\common\logic\BaseLogic;
use think\facade\Db;
/**
* 采购订单逻辑
* Class OpurchaseclassLogic
* @package app\admin\logic\operation
*/
class OpurchaseclassLogic extends BaseLogic
{
/**
* @notes 添加采购订单
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/27 11:26
*/
public static function add(array $params): bool
{
Db::startTrans();
try {
Opurchaseclass::create([
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑采购订单
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/27 11:26
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
Opurchaseclass::where('id', $params['id'])->update([
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除采购订单
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/04/27 11:26
*/
public static function delete(array $params): bool
{
return Opurchaseclass::destroy($params['id']);
}
/**
* @notes 获取采购订单详情
* @param $params
* @return array
* @author likeadmin
* @date 2024/04/27 11:26
*/
public static function detail($params): array
{
return Opurchaseclass::findOrEmpty($params['id'])->toArray();
}
}

View File

@ -0,0 +1,82 @@
<?php
namespace app\admin\validate\goods;
use app\common\validate\BaseValidate;
/**
* 商品标签验证器
* Class GoodsLabelValidate
* @package app\admin\validate\goods
*/
class GoodsLabelValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
];
/**
* @notes 添加场景
* @return GoodsLabelValidate
* @author likeadmin
* @date 2024/04/27 09:23
*/
public function sceneAdd()
{
return $this->remove('id', true);
}
/**
* @notes 编辑场景
* @return GoodsLabelValidate
* @author likeadmin
* @date 2024/04/27 09:23
*/
public function sceneEdit()
{
return $this->only(['id']);
}
/**
* @notes 删除场景
* @return GoodsLabelValidate
* @author likeadmin
* @date 2024/04/27 09:23
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return GoodsLabelValidate
* @author likeadmin
* @date 2024/04/27 09:23
*/
public function sceneDetail()
{
return $this->only(['id']);
}
}

View File

@ -0,0 +1,82 @@
<?php
namespace app\admin\validate\operation;
use app\common\validate\BaseValidate;
/**
* 采购订单验证器
* Class OpurchaseclassValidate
* @package app\admin\validate\operation
*/
class OpurchaseclassValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
];
/**
* @notes 添加场景
* @return OpurchaseclassValidate
* @author likeadmin
* @date 2024/04/27 11:26
*/
public function sceneAdd()
{
return $this->remove('id', true);
}
/**
* @notes 编辑场景
* @return OpurchaseclassValidate
* @author likeadmin
* @date 2024/04/27 11:26
*/
public function sceneEdit()
{
return $this->only(['id']);
}
/**
* @notes 删除场景
* @return OpurchaseclassValidate
* @author likeadmin
* @date 2024/04/27 11:26
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return OpurchaseclassValidate
* @author likeadmin
* @date 2024/04/27 11:26
*/
public function sceneDetail()
{
return $this->only(['id']);
}
}

View File

@ -0,0 +1,37 @@
<?php
namespace app\api\controller\order;
use app\api\logic\order\OrderLogic;
use app\api\controller\BaseApiController;
/**
* 采购单控制器
*/
class OpurchaseOrderController extends BaseApiController
{
public function checkOrder(){
$params=$this->request->get();
$res=OrderLogic::cartIdByPurchaseOrderInfo($this->request->userInfo,$params);
if($res==false){
return $this->fail(OrderLogic::getError());
}
return $this->data($res);
}
/**
* @notes 创建购货订单
*/
public function createOrder(){
$params=$this->request->post();
$order=OrderLogic::createOpurchaseOrder(request()->userInfo,$params);
if($order==false){
return $this->fail(OrderLogic::getError());
}else{
return $this->success('支付成功');
}
}
}

View File

@ -1,50 +0,0 @@
<?php
namespace app\api\controller\order;
use app\admin\logic\order\CartLogic;
use app\api\logic\order\OrderLogic;
use app\api\controller\BaseApiController;
use app\common\logic\order\RetailOrderLogic;
use app\common\enum\PayEnum;
use app\common\model\order\Cart;
use app\common\model\user\User;
/**
* 购货单控制器
*/
class PurchaseOrderController extends BaseApiController
{
public function checkOrder(){
$params=$this->request->get();
$params['store_id']=1;
$res=OrderLogic::cartIdByPurchaseOrderInfo($params);
return $this->data($res);
}
/**
* @notes 创建购货订单
*/
public function createOrder(){
$user=User::where('id',$this->request->userId)->find();
$cartId = (Array)$this->request->post('cart_id', []);
$addressId = (int)$this->request->post('address_id');
$pay_type = (int)$this->request->post('pay_type');
$auth_code = $this->request->post('auth_code'); //微信支付条码
$params=$this->request->post();
$order=OrderLogic::createOrder($cartId,$addressId,null,$params);
if(is_object($order)){
if($pay_type==PayEnum::BALANCE_PAY){
$user=User::where('id',$this->request->userId)->find();
RetailOrderLogic::payBalance($user,$order);
return $this->success('支付成功');
}
return $this->data(['order_id'=>$order->id]);
}else{
return $this->fail(OrderLogic::getError());
}
}
}

View File

@ -35,11 +35,19 @@ class RetailOrderController extends BaseApiController
$auth_code = $this->request->post('auth_code'); //微信支付条码
$params=$this->request->post();
$order=OrderLogic::createOrder($cartId,$addressId,null,$params);
if(is_object($order)){
if($order!=false){
if($pay_type==PayEnum::BALANCE_PAY){
$user=User::where('id',$this->request->userId)->find();
RetailOrderLogic::payBalance($user,$order);
return $this->success('支付成功');
$res=RetailOrderLogic::payBalance($user,$order);
if($res==true){
$res=RetailOrderLogic::paySuccess($order, ['money'=>$order['actual']]);
if($res){
}else{
return $this->fail(RetailOrderLogic::getError());
}
}else{
return $this->fail(RetailOrderLogic::getError());
}
}
return $this->data(['order_id'=>$order->id]);
}else{

View File

@ -4,6 +4,9 @@ namespace app\api\logic\order;
use app\common\logic\BaseLogic;
use app\common\model\goods\Goods;
use app\common\model\merchat\Merchant;
use app\common\model\opurchase\Opurchaseclass;
use app\common\model\opurchase\Opurchaseinfo;
use app\common\model\order\Cart;
use app\common\model\retail\Cashierclass;
use app\common\model\retail\Cashierinfo;
@ -40,19 +43,18 @@ class OrderLogic extends BaseLogic
'time' => time(),
'number' => static::getNewOrderId('PF'),
'total' => array_sum(array_column($cart_select, 'total')),
'pay_type' => $params['pay_type'],
'cart_id'=>explode(',',$cartId)
'pay_type' => $params['pay_type']??0,
'cart_id'=>implode(',',$cartId)
];
return ['order' => $order, 'cart_list' => $cart_select];
}
/**
* 创建新订单
* @return Object
* @return Object|bool
*/
static public function createOrder($cartId, $addressId, $user = null, $params = []): Object
static public function createOrder($cartId, $addressId, $user = null, $params = [])
{
$orderInfo = self::cartIdByOrderInfo($cartId, $addressId, $user, $params);
$_order = $orderInfo['order'];
$_order['deduction_price'] = 0;
@ -91,16 +93,29 @@ class OrderLogic extends BaseLogic
* @param $params
* @return array
*/
static public function cartIdByPurchaseOrderInfo($params = [])
static public function cartIdByPurchaseOrderInfo($user, $params)
{
if(!$user){
self::setError('没有用户信息,请先登录');
return false;
}
$mer_id=$user['merchant']['mer_id'];
$where1=['paid'=>1];
d(222);
$cartId=Cashierinfo::where('store_id',$params['store_id'])->where($where1)->select();
throw new \RuntimeException("Command has no defaultName");
$cartId=implode(',',$cartId);
var_dump($cartId);
$where = ['is_pay' => 0, 'is_fail' => 0];
$cart_select = Cart::whereIn('cart_id', $cartId)->where($where)->field('goods_id as goods,cart_num')->select()->toArray();
$cartId=Cashierclass::where('merchant',$mer_id)->whereDay('create_time')->where($where1)->column('cart_id');
if(empty($cartId)){
self::setError('没有购物车信息');
return false;
}
$order_id=Cashierclass::where('merchant',$mer_id)->whereDay('create_time')->where($where1)->column('id');
$cart_arr=[];
foreach($cartId as $k=>$v){
$arr=explode(',',$v);
foreach($arr as $kk=>$vv){
$cart_arr[]=$vv;
}
}
$where = ['is_pay' => 1, 'is_fail' => 0];
$cart_select = Cart::whereIn('cart_id', $cart_arr)->where($where)->field('goods_id as goods,cart_num')->select()->toArray();
if (empty($cart_select)) {
self::setError('购物车为空');
return false;
@ -113,44 +128,52 @@ class OrderLogic extends BaseLogic
}
$order = [
'time' => time(),
'number' => static::getNewOrderId('PF'),
'number' => static::getNewOrderId('CG'),
'total' => array_sum(array_column($cart_select, 'total')),
'pay_type' => $params['pay_type'],
'cart_id'=>explode(',',$cartId)
'pay_type' => $params['pay_type']??0,
'cart_id'=>implode(',',$cart_arr),
'order_arr'=>implode(',',$order_id)
];
return ['order' => $order, 'cart_list' => $cart_select];
}
/**
* 创建购货订单
* @return Object
* @return Object|bool
*/
static public function createPurchaseOrder($cartId, $addressId, $user = null, $params = []): Object
static public function createOpurchaseOrder($user = null, $params = [])
{
$orderInfo = self::cartIdByOrderInfo($cartId, $addressId, $user, $params);
if(!$user){
self::setError('没有用户信息,请先登录');
return false;
}
$mer_id=$user['merchant']['mer_id'];
$merchant=Merchant::where('mer_id',$mer_id)->find();
$orderInfo = self::cartIdByPurchaseOrderInfo($user, $params);
if(!$orderInfo){
return false;
}
$_order = $orderInfo['order'];
$_order['deduction_price'] = 0;
$_order['merchant'] = 0;
$_order['customer'] = request()->userId;
$_order['money'] = 0;
$_order['user'] = request()->userId;
$_order['account'] = 0;
$_order['payinfo'] = '';
$_order['type'] = 0;
if($_order['total']<$merchant['mer_money']){
self::setError('商户余额不足');
return false;
}
$_order['merchant'] = $mer_id;
$_order['money'] = $_order['total'];
$_order['actual'] = $_order['total'];
$_order['paid'] = 1;
Db::startTrans();
try {
$order = Cashierclass::create($_order);
$order = Opurchaseclass::create($_order);
$goods_list = $orderInfo['cart_list'];
foreach ($goods_list as $k => $v) {
$goods_list[$k]['pid'] = $order->id;
$goods_list[$k]['merchant'] = 0;
$goods_list[$k]['room'] = 0;
$goods_list[$k]['discount'] = 0;
$goods_list[$k]['warehouse'] = 0;
$goods_list[$k]['nums'] = $v['cart_num'];
}
(new Cashierinfo())->saveAll($goods_list);
(new Opurchaseinfo())->saveAll($goods_list);
$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();
return $order;
} catch (\Exception $e) {

View File

@ -1,29 +0,0 @@
<?php
namespace app\ceshi\controller;
use support\Request;
class IndexController
{
public function index(Request $request)
{
d(231232);
static $readme;
if (!$readme) {
$readme = file_get_contents(base_path('README.md'));
}
return $readme;
}
public function view(Request $request)
{
return view('index/view', ['name' => 'webman']);
}
public function json(Request $request)
{
return json(['code' => 0, 'msg' => 'ok']);
}
}

View File

@ -15,6 +15,7 @@
namespace app\common\cache;
use app\common\model\merchat\Merchant;
use app\common\model\user\User;
use app\common\model\user\UserSession;
use support\Cache;
@ -72,10 +73,11 @@ class UserTokenCache extends BaseCache
$user = User::where('id', '=', $userSession->user_id)
->find();
$merchant=Merchant::where('uid',$userSession->user_id)->find();
$userInfo = [
'user_id' => $user->id,
'nickname' => $user->nickname,
'merchant' => $merchant,
'token' => $token,
'sn' => $user->sn,
'mobile' => $user->mobile,

View File

@ -64,8 +64,6 @@ class RetailOrderLogic extends BaseLogic
'mer_id' => $order['merchant'],
];
(new FinancialRecord())->saveAll($record);
$CallbackData = ['money' => $order['actual']];
self::paySuccess($order, $CallbackData);
Db::commit();
return true;
} catch (Exception $e) {
@ -90,16 +88,24 @@ class RetailOrderLogic extends BaseLogic
$order->paid = 1;
$order->save();
if($order['cart_id']){
$cart_arr=implode(',',$order['cart_id']);
Cart::whereIn('id',$cart_arr)->update(['is_pay'=>1]);
if(!is_array($order['cart_id'])){
$cart_arr=explode(',',$order['cart_id']);
Cart::whereIn('cart_id',$cart_arr)->update(['is_pay'=>1]);
}else{
Cart::whereIn('cart_id',$order['cart_id'])->update(['is_pay'=>1]);
}
}
Log::info('支付成功');
// 提交事务
Db::commit();
return true;
} catch (\Exception $e) {
// 回滚事务
Db::rollback();
Log::error('支付失败'.$e->getMessage().'。like:'.$e->getLine());
self::setError('支付失败'.$e->getMessage());
return false;
}
// TODO: Implement paySuccess() method.
}
}

View File

@ -23,6 +23,21 @@ class Goods extends BaseModel
{
return explode(',',$value);
}
public function setSysLabelAttr($value)
{
if (!empty($value)) {
if (!is_array($value))
return ','. $value .',';
return ','. implode(',', $value) .',';
}
return $value;
}
public function getSysLabelAttr($value)
{
if (!$value) return [];
return explode(',',rtrim(ltrim($value,','),','));
}
public function className()
{
return $this->hasOne(Goodsclass::class,'id','class')->bind(['class_name'=>'name']);

View File

@ -0,0 +1,22 @@
<?php
namespace app\common\model\goods;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 商品标签模型
* Class GoodsLabel
* @package app\common\model\goods
*/
class GoodsLabel extends BaseModel
{
use SoftDelete;
protected $name = 'goods_label';
protected $deleteTime = 'delete_time';
}

View File

@ -0,0 +1,22 @@
<?php
namespace app\common\model\operation;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 采购订单模型
* Class Opurchaseclass
* @package app\common\model\operation
*/
class Opurchaseclass extends BaseModel
{
use SoftDelete;
protected $name = 'opurchaseclass';
protected $deleteTime = 'delete_time';
}

View File

@ -0,0 +1,22 @@
<?php
namespace app\common\model\opurchase;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 采购订单模型
* Class Opurchaseclass
* @package app\common\model\Opurchaseclass
*/
class Opurchaseclass extends BaseModel
{
use SoftDelete;
protected $name = 'Opurchaseclass';
protected $deleteTime = 'delete_time';
}

View File

@ -0,0 +1,22 @@
<?php
namespace app\common\model\opurchase;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 采购订单详情模型
* Class Opurchaseinfo
* @package app\common\model\Opurchaseinfo
*/
class Opurchaseinfo extends BaseModel
{
use SoftDelete;
protected $name = 'Opurchaseinfo';
protected $deleteTime = 'delete_time';
}

View File

@ -43,7 +43,6 @@
"php-di/php-di": "^6",
"doctrine/annotations": "^1.14",
"illuminate/redis": "^10.22",
"max/var-dumper": "^0.1.1",
"symfony/cache": "^6.4",
"yansongda/pay": "^3.6",
"tinywan/jwt": "^1.9",

58
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "b6311149dd1b6bc25d90d13a3bc78a00",
"content-hash": "f2ed4dce154e90b0dc1dac507e163128",
"packages": [
{
"name": "aliyuncs/oss-sdk-php",
@ -1964,62 +1964,6 @@
},
"time": "2022-12-02T22:17:43+00:00"
},
{
"name": "max/var-dumper",
"version": "0.1.1",
"source": {
"type": "git",
"url": "https://github.com/next-laboratory/var-dumper.git",
"reference": "603bdeb2135b24c9eb91e559df1f9fc6a95b811d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/next-laboratory/var-dumper/zipball/603bdeb2135b24c9eb91e559df1f9fc6a95b811d",
"reference": "603bdeb2135b24c9eb91e559df1f9fc6a95b811d",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=7.4",
"symfony/var-dumper": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "0.1.x-dev"
}
},
"autoload": {
"files": [
"src/helpers.php"
],
"psr-4": {
"Max\\VarDumper\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "chengyao",
"email": "987861463@qq.com"
}
],
"homepage": "https://github.com/marxphp/var-dumper",
"support": {
"issues": "https://github.com/next-laboratory/var-dumper/issues",
"source": "https://github.com/next-laboratory/var-dumper/tree/0.1.1"
},
"abandoned": "next/var-dumper",
"time": "2023-07-07T12:54:36+00:00"
},
{
"name": "monolog/monolog",
"version": "2.9.2",

View File

@ -15,5 +15,5 @@
return [
// '' => support\exception\Handler::class,
// '' => app\common\exception\Handler::class,
'' => \App\ExceptionHandler::class,
'' => app\ExceptionHandler::class,
];

View File

@ -24,13 +24,13 @@ return [
// 权限认证
app\admin\middleware\AuthMiddleware::class,
],
// 'api' => [
// // 跨域中间件
// app\common\http\middleware\AdminAllowMiddleware::class,
'api' => [
// 跨域中间件
app\common\http\middleware\AdminAllowMiddleware::class,
// app\api\http\middleware\InitMiddleware::class,
app\api\http\middleware\InitMiddleware::class,
// app\api\http\middleware\LoginMiddleware::class,
app\api\http\middleware\LoginMiddleware::class,
// ]
]
];

View File

@ -23,7 +23,7 @@ return [
// 断线重连
'break_reconnect' => true,
// 关闭SQL监听日志
'trigger_sql' => true,
'trigger_sql' => false,
// 自定义分页类
'bootstrap' => ''
],