commit
c8d8724b03
27
app/admin/controller/IndexController.php
Normal file
27
app/admin/controller/IndexController.php
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
namespace app\admin\controller;
|
||||||
|
|
||||||
|
use app\common\service\pay\PayService;
|
||||||
|
|
||||||
|
class IndexController extends BaseAdminController
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 查询订单支付状态
|
||||||
|
*/
|
||||||
|
public function wechatQuery()
|
||||||
|
{
|
||||||
|
$order_no = $this->request->get('order_no');
|
||||||
|
$order = [
|
||||||
|
'out_trade_no' => $order_no,
|
||||||
|
];
|
||||||
|
$app = new PayService(0);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$res = $app->wechat->query($order);
|
||||||
|
return $this->success('查询成功', $res->toArray());
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->fail($e->extra['message']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -82,4 +82,20 @@ class UserController extends BaseAdminController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//用户领取列表
|
||||||
|
public function userGiftList()
|
||||||
|
{
|
||||||
|
$uid = (new UserValidate())->goCheck('detail');
|
||||||
|
$page_no = (int)$this->request->get('page_no', 1);
|
||||||
|
$page_size = (int)$this->request->get('page_size', 15);
|
||||||
|
$params = $this->request->get();
|
||||||
|
$params['page_no'] = $page_no > 0 ? $page_no : 1;
|
||||||
|
$params['page_size'] = $page_size > 0 ? $page_size : 15;
|
||||||
|
$uid = $uid['id'];
|
||||||
|
$res = UserLogic::giftList($uid,$params);
|
||||||
|
$res['page_no'] = $params['page_no'];
|
||||||
|
$res['page_size'] = $params['page_size'];
|
||||||
|
return $this->success('ok', $res);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -210,7 +210,8 @@ class StoreProductLogic extends BaseLogic
|
|||||||
'batch'=>$params['batch'],'store_name'=>$params['store_name'],
|
'batch'=>$params['batch'],'store_name'=>$params['store_name'],
|
||||||
'manufacturer_information' => $params['manufacturer_information']??'',
|
'manufacturer_information' => $params['manufacturer_information']??'',
|
||||||
'store_info' => $params['store_info']??'','cate_id'=>$params['cate_id'],
|
'store_info' => $params['store_info']??'','cate_id'=>$params['cate_id'],
|
||||||
'top_cate_id'=>$dealCate['top_cate_id'],'two_cate_id'=>$dealCate['two_cate_id']
|
'top_cate_id'=>$dealCate['top_cate_id'],'two_cate_id'=>$dealCate['two_cate_id'],
|
||||||
|
'bar_code'=> $params['bar_code']
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Db::commit();
|
Db::commit();
|
||||||
|
@ -20,6 +20,7 @@ use app\common\logic\BaseLogic;
|
|||||||
use app\common\model\finance\CapitalFlow;
|
use app\common\model\finance\CapitalFlow;
|
||||||
use app\common\model\store_finance_flow\StoreFinanceFlow;
|
use app\common\model\store_finance_flow\StoreFinanceFlow;
|
||||||
use app\common\model\store_order\StoreOrder;
|
use app\common\model\store_order\StoreOrder;
|
||||||
|
use app\common\model\store_product_gift\StoreProductGift;
|
||||||
use app\common\model\user\User;
|
use app\common\model\user\User;
|
||||||
use app\common\model\user\UserAddress;
|
use app\common\model\user\UserAddress;
|
||||||
use app\common\model\user\UserRecharge;
|
use app\common\model\user\UserRecharge;
|
||||||
@ -77,6 +78,34 @@ class UserLogic extends BaseLogic
|
|||||||
|
|
||||||
public static function StoreAdd(array $params)
|
public static function StoreAdd(array $params)
|
||||||
{
|
{
|
||||||
|
$user_ship=$params['user_ship']??0;
|
||||||
|
if($user_ship==2){
|
||||||
|
if(!isset($params['village'])){
|
||||||
|
self::setError('请设置村参数');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$arr=User::where('user_ship',$user_ship)->column('id');
|
||||||
|
if($arr){
|
||||||
|
$find=UserAddress::where('uid','in',$arr)->where('village',$params['village'])->find();
|
||||||
|
if($find){
|
||||||
|
self::setError('该区域已有村长请重新选择');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}elseif($user_ship==3){
|
||||||
|
if(!isset($params['brigade'])){
|
||||||
|
self::setError('请设置队参数');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$arr=User::where('user_ship',$user_ship)->column('id');
|
||||||
|
if($arr){
|
||||||
|
$find=UserAddress::where('uid','in',$arr)->where('village',$params['village'])->where('brigade',$params['brigade'])->find();
|
||||||
|
if($find){
|
||||||
|
self::setError('该区域已有队长请重新选择');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
$passwordSalt = Config::get('project.unique_identification');
|
$passwordSalt = Config::get('project.unique_identification');
|
||||||
$password = create_password(123456, $passwordSalt);
|
$password = create_password(123456, $passwordSalt);
|
||||||
$defaultAvatar = config('project.default_image.admin_avatar');
|
$defaultAvatar = config('project.default_image.admin_avatar');
|
||||||
@ -102,6 +131,7 @@ class UserLogic extends BaseLogic
|
|||||||
'create_uid' => $params['create_uid']??0,
|
'create_uid' => $params['create_uid']??0,
|
||||||
'store_id' => $params['store_id']??0,
|
'store_id' => $params['store_id']??0,
|
||||||
'staff_id' => $params['staff_id']??0,
|
'staff_id' => $params['staff_id']??0,
|
||||||
|
'user_ship' => $data['user_ship']??0,
|
||||||
]);
|
]);
|
||||||
UserAddress::create([
|
UserAddress::create([
|
||||||
'uid' => $res['id'],
|
'uid' => $res['id'],
|
||||||
@ -200,7 +230,7 @@ class UserLogic extends BaseLogic
|
|||||||
switch ($params['type']){
|
switch ($params['type']){
|
||||||
case 1:
|
case 1:
|
||||||
//采购款明细
|
//采购款明细
|
||||||
$categories = ['user_balance_recharge', 'user_order_purchase_pay','system_purchase_add'];
|
$categories = ['user_balance_recharge', 'user_order_purchase_pay','system_purchase_add','user_balance_recharge_refund'];
|
||||||
$query = CapitalFlow::where('uid', $params['id'])
|
$query = CapitalFlow::where('uid', $params['id'])
|
||||||
->whereIn('category', $categories);
|
->whereIn('category', $categories);
|
||||||
$count = $query->count();
|
$count = $query->count();
|
||||||
@ -260,4 +290,18 @@ class UserLogic extends BaseLogic
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function giftList($uid,$params)
|
||||||
|
{
|
||||||
|
$query = StoreProductGift::with(['store','user','goodsName'])->where('uid',$uid);
|
||||||
|
$count = $query->count();
|
||||||
|
$list = $query->page($params['page_no'],$params['page_size'])
|
||||||
|
->order('id','desc')
|
||||||
|
->select()->toArray();
|
||||||
|
return [
|
||||||
|
'lists' => $list,
|
||||||
|
'count' => $count
|
||||||
|
];
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,8 @@ namespace app\admin\logic\user_ship;
|
|||||||
|
|
||||||
use app\common\model\user_ship\UserShip;
|
use app\common\model\user_ship\UserShip;
|
||||||
use app\common\logic\BaseLogic;
|
use app\common\logic\BaseLogic;
|
||||||
|
use app\common\model\user\User;
|
||||||
|
use app\common\model\user\UserAddress;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
|
|
||||||
|
|
||||||
@ -95,4 +97,47 @@ class UserShipLogic extends BaseLogic
|
|||||||
{
|
{
|
||||||
return UserShip::findOrEmpty($params['id'])->toArray();
|
return UserShip::findOrEmpty($params['id'])->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否有村长或者对长
|
||||||
|
* @param $params array 参数数组
|
||||||
|
*/
|
||||||
|
public static function user_ship($params){
|
||||||
|
$user_ship=$params['user_ship']??0;
|
||||||
|
if($user_ship==2){
|
||||||
|
if(!isset($params['village'])){
|
||||||
|
self::setError('请设置村参数');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$arr=User::where('user_ship',$user_ship)->column('id');
|
||||||
|
if($arr){
|
||||||
|
$find=UserAddress::where('uid','in',$arr)->where('village',$params['village'])->find();
|
||||||
|
if($find){
|
||||||
|
if($params['uid']==$find['uid']){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
self::setError('该区域已有村长请重新选择');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}elseif($user_ship==3){
|
||||||
|
if(!isset($params['brigade'])){
|
||||||
|
self::setError('请设置队参数');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$arr=User::where('user_ship',$user_ship)->column('id');
|
||||||
|
if($arr){
|
||||||
|
$find=UserAddress::where('uid','in',$arr)->where('village',$params['village'])->where('brigade',$params['brigade'])->find();
|
||||||
|
if($find){
|
||||||
|
if($params['uid']==$find['uid']){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
self::setError('该区域已有队长请重新选择');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -38,10 +38,12 @@ class PayController extends BaseApiController
|
|||||||
$app->wechat->success();
|
$app->wechat->success();
|
||||||
break;
|
break;
|
||||||
case 'wechat_common':
|
case 'wechat_common':
|
||||||
default:
|
|
||||||
PayNotifyLogic::handle('wechat_common', $ciphertext['out_trade_no'], $ciphertext);
|
PayNotifyLogic::handle('wechat_common', $ciphertext['out_trade_no'], $ciphertext);
|
||||||
$app->wechat->success();
|
$app->wechat->success();
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
Log::error('支付回调失败,订单号:' . $ciphertext['out_trade_no'], $ciphertext);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -68,7 +70,6 @@ class PayController extends BaseApiController
|
|||||||
public function wechatQuery()
|
public function wechatQuery()
|
||||||
{
|
{
|
||||||
$order_no = $this->request->get('order_no');
|
$order_no = $this->request->get('order_no');
|
||||||
$recharge = $this->request->get('recharge', 0);
|
|
||||||
$order = [
|
$order = [
|
||||||
'out_trade_no' => $order_no,
|
'out_trade_no' => $order_no,
|
||||||
];
|
];
|
||||||
@ -77,13 +78,22 @@ class PayController extends BaseApiController
|
|||||||
try {
|
try {
|
||||||
$res = $app->wechat->query($order);
|
$res = $app->wechat->query($order);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return $this->fail($e->extra['message']);
|
return $this->fail($e->extra['message'] ?? $e->getMessage());
|
||||||
}
|
}
|
||||||
if ($res['trade_state'] == 'SUCCESS' && $res['trade_state_desc'] == '支付成功') {
|
if ($res['trade_state'] == 'SUCCESS' && $res['trade_state_desc'] == '支付成功') {
|
||||||
if ($recharge == 0) {
|
$attach = $res['attach'];
|
||||||
PayNotifyLogic::handle('wechat_common', $res['out_trade_no'], $res);
|
switch ($attach) {
|
||||||
} else {
|
case 'recharge':
|
||||||
PayNotifyLogic::handle('recharge', $res['out_trade_no'], $res);
|
PayNotifyLogic::handle('recharge', $res['out_trade_no'], $res);
|
||||||
|
$app->wechat->success();
|
||||||
|
break;
|
||||||
|
case 'wechat_common':
|
||||||
|
PayNotifyLogic::handle('wechat_common', $res['out_trade_no'], $res);
|
||||||
|
$app->wechat->success();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Log::error('支付回调失败,订单号:' . $res['out_trade_no'], $res);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return $this->success('支付成功');
|
return $this->success('支付成功');
|
||||||
} else {
|
} else {
|
||||||
|
@ -14,6 +14,7 @@ use app\common\logic\PaymentLogic;
|
|||||||
use app\common\logic\PayNotifyLogic;
|
use app\common\logic\PayNotifyLogic;
|
||||||
use app\common\model\Config;
|
use app\common\model\Config;
|
||||||
use app\common\model\user\User;
|
use app\common\model\user\User;
|
||||||
|
use app\common\model\user\UserAddress;
|
||||||
use app\common\model\user_create_log\UserCreateLog;
|
use app\common\model\user_create_log\UserCreateLog;
|
||||||
use app\common\model\user_recharge\UserRecharge;
|
use app\common\model\user_recharge\UserRecharge;
|
||||||
use support\Cache;
|
use support\Cache;
|
||||||
@ -84,13 +85,31 @@ class StoreController extends BaseApiController
|
|||||||
if(!$find){
|
if(!$find){
|
||||||
$params['create_uid']=$this->userId;
|
$params['create_uid']=$this->userId;
|
||||||
$find=UserUserLogic::StoreAdd($params);
|
$find=UserUserLogic::StoreAdd($params);
|
||||||
|
if(UserUserLogic::hasError()){
|
||||||
|
return $this->fail(UserUserLogic::getError());
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
$find['real_name']=$params['real_name'];
|
$find['real_name']=$params['real_name'];
|
||||||
$find['label_id']=$params['label_id']??0;
|
$find['label_id']=$params['label_id']??0;
|
||||||
$find->save();
|
$find->save();
|
||||||
|
$adds=UserAddress::where('uid',$find['id'])->find();
|
||||||
|
$adds_data=[
|
||||||
|
'uid' => $find['id'],
|
||||||
|
'real_name' => $params['real_name']??"",
|
||||||
|
'mobile' => $params['mobile']??'',
|
||||||
|
'province' => $params['province']??'',
|
||||||
|
'city' => $params['city']??'',
|
||||||
|
'area' => $params['area']??'',
|
||||||
|
'street' => $params['street']??'',
|
||||||
|
'village' => $params['village']??'',
|
||||||
|
'brigade' => $params['brigade']??'',
|
||||||
|
'is_default' => 1,
|
||||||
|
];
|
||||||
|
if($adds){
|
||||||
|
$adds->save($adds_data);
|
||||||
|
}else{
|
||||||
|
UserAddress::create($adds_data);
|
||||||
}
|
}
|
||||||
if($find === false){
|
|
||||||
return $this->fail(UserUserLogic::getError());
|
|
||||||
}
|
}
|
||||||
if($recharge_type!='INDUSTRYMEMBERS'){
|
if($recharge_type!='INDUSTRYMEMBERS'){
|
||||||
return $this->success('添加用户成功');
|
return $this->success('添加用户成功');
|
||||||
@ -108,6 +127,7 @@ class StoreController extends BaseApiController
|
|||||||
$order = UserRecharge::create($data);
|
$order = UserRecharge::create($data);
|
||||||
|
|
||||||
$order['pay_price']=$order['price'];
|
$order['pay_price']=$order['price'];
|
||||||
|
$order['attach']=$order['recharge'];
|
||||||
$result = PaymentLogic::codepay($auth_code, $order,'条码支付');
|
$result = PaymentLogic::codepay($auth_code, $order,'条码支付');
|
||||||
if (PaymentLogic::hasError()) {
|
if (PaymentLogic::hasError()) {
|
||||||
return $this->fail(PaymentLogic::getError());
|
return $this->fail(PaymentLogic::getError());
|
||||||
@ -136,6 +156,7 @@ class StoreController extends BaseApiController
|
|||||||
UserRecharge::where('id', $id)->update(['order_id'=>$order_id]);
|
UserRecharge::where('id', $id)->update(['order_id'=>$order_id]);
|
||||||
$order['order_id']=$order_id;
|
$order['order_id']=$order_id;
|
||||||
$order['pay_price']=$order['price'];
|
$order['pay_price']=$order['price'];
|
||||||
|
$order['attach']=$order['recharge'];
|
||||||
$result = PaymentLogic::codepay($auth_code, $order,'条码支付');
|
$result = PaymentLogic::codepay($auth_code, $order,'条码支付');
|
||||||
if (PaymentLogic::hasError()) {
|
if (PaymentLogic::hasError()) {
|
||||||
return $this->fail(PaymentLogic::getError());
|
return $this->fail(PaymentLogic::getError());
|
||||||
|
@ -10,7 +10,6 @@ use app\api\lists\user\UserRechargeLists;
|
|||||||
|
|
||||||
class UserRechargeController extends BaseApiController
|
class UserRechargeController extends BaseApiController
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notes 获取用户充值
|
* @notes 获取用户充值
|
||||||
* @return \support\Response
|
* @return \support\Response
|
||||||
@ -21,4 +20,40 @@ use app\api\lists\user\UserRechargeLists;
|
|||||||
{
|
{
|
||||||
return $this->dataLists(new UserRechargeLists());
|
return $this->dataLists(new UserRechargeLists());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function recharge_list()
|
||||||
|
{
|
||||||
|
$buy_bar = "元采购包";
|
||||||
|
$send_bar = "品牌礼品券";
|
||||||
|
$arr = [
|
||||||
|
[
|
||||||
|
'money'=>1000,//采购包
|
||||||
|
'send'=>249,//礼品券
|
||||||
|
'money_string'=>$buy_bar,
|
||||||
|
'send_string'=>$send_bar,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'money'=>2000,//采购包
|
||||||
|
'send'=>560,//礼品券
|
||||||
|
'money_string'=>$buy_bar,
|
||||||
|
'send_string'=>$send_bar,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'money'=>5000,//采购包
|
||||||
|
'send'=>1550,//礼品券
|
||||||
|
'money_string'=>$buy_bar,
|
||||||
|
'send_string'=>$send_bar,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'money'=>10000,//采购包
|
||||||
|
'send'=>3500,//礼品券
|
||||||
|
'money_string'=>$buy_bar,
|
||||||
|
'send_string'=>$send_bar,
|
||||||
|
]
|
||||||
|
];
|
||||||
|
return $this->success('ok',$arr);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace app\api\controller\user_ship;
|
namespace app\api\controller\user_ship;
|
||||||
|
|
||||||
|
use app\admin\logic\user_ship\UserShipLogic;
|
||||||
use app\api\controller\BaseApiController;
|
use app\api\controller\BaseApiController;
|
||||||
use app\common\lists\user\UserShipLists;
|
use app\common\lists\user\UserShipLists;
|
||||||
|
|
||||||
@ -28,4 +28,13 @@ class UserShipController extends BaseApiController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function is_user_ship(){
|
||||||
|
$data=$this->request->post();
|
||||||
|
UserShipLogic::user_ship($data);
|
||||||
|
if(UserShipLogic::hasError()){
|
||||||
|
return $this->fail(UserShipLogic::getError());
|
||||||
|
}else{
|
||||||
|
return $this->success('ok');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -112,6 +112,7 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
|
|||||||
'pay_price' => $this->total_price
|
'pay_price' => $this->total_price
|
||||||
];
|
];
|
||||||
if($this->off_activity==1){
|
if($this->off_activity==1){
|
||||||
|
$this->activity_price = $this->total_price;
|
||||||
$data['pay_price']=$this->activity_price;
|
$data['pay_price']=$this->activity_price;
|
||||||
if($this->activity_price<500){
|
if($this->activity_price<500){
|
||||||
$data['msg']='还差'.bcsub(500,$this->activity_price,2).'即可获得10%的品牌礼品兑换券,可到线下门店兑换礼品。';
|
$data['msg']='还差'.bcsub(500,$this->activity_price,2).'即可获得10%的品牌礼品兑换券,可到线下门店兑换礼品。';
|
||||||
|
@ -117,19 +117,19 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, L
|
|||||||
public function extend()
|
public function extend()
|
||||||
{
|
{
|
||||||
$off_activity = Config::where('name', 'off_activity')->value('value');
|
$off_activity = Config::where('name', 'off_activity')->value('value');
|
||||||
if($off_activity==1){
|
// if($off_activity==1){
|
||||||
$data=[
|
// $data=[
|
||||||
'off_activity' => $off_activity,
|
// 'off_activity' => $off_activity,
|
||||||
'price' => 'cost',
|
// 'price' => 'cost',
|
||||||
'op_price' => 'price',
|
// 'op_price' => 'price',
|
||||||
];
|
// ];
|
||||||
}else{
|
// }else{
|
||||||
$data=[
|
$data=[
|
||||||
'off_activity' => $off_activity,
|
'off_activity' => $off_activity,
|
||||||
'price' => 'price',
|
'price' => 'price',
|
||||||
'op_price' => 'price',
|
'op_price' => 'price',
|
||||||
];
|
];
|
||||||
}
|
// }
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,7 @@ class UserCreateLogLists extends BaseAdminDataLists implements ListsSearchInterf
|
|||||||
*/
|
*/
|
||||||
public function lists(): array
|
public function lists(): array
|
||||||
{
|
{
|
||||||
|
$this->searchWhere['user_ship'] =4;
|
||||||
$data = UserCreateLog::where($this->searchWhere)
|
$data = UserCreateLog::where($this->searchWhere)
|
||||||
->limit($this->limitOffset, $this->limitLength)
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
->order(['id' => 'desc'])
|
->order(['id' => 'desc'])
|
||||||
|
@ -74,7 +74,7 @@ class OrderLogic extends BaseLogic
|
|||||||
self::$cost = 0; //成本由采购价替代原成本为门店零售价
|
self::$cost = 0; //成本由采购价替代原成本为门店零售价
|
||||||
self::$profit = 0; //利润
|
self::$profit = 0; //利润
|
||||||
self::$activity_price = 0; //活动减少
|
self::$activity_price = 0; //活动减少
|
||||||
self::$store_price = 0; //门店零售价
|
self::$store_price = 0; //商户价
|
||||||
self::$deduction_price =0;
|
self::$deduction_price =0;
|
||||||
$deduction_price = 0; //抵扣金额
|
$deduction_price = 0; //抵扣金额
|
||||||
/** 计算价格 */
|
/** 计算价格 */
|
||||||
@ -91,20 +91,21 @@ class OrderLogic extends BaseLogic
|
|||||||
}
|
}
|
||||||
unset($cart_select[$k]['id']);
|
unset($cart_select[$k]['id']);
|
||||||
$cart_select[$k]['total_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单总价
|
$cart_select[$k]['total_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单总价
|
||||||
if ($off_activity == 1) {
|
// if ($off_activity == 1) {
|
||||||
$price = $find['cost'];
|
// $price = $find['cost'];
|
||||||
} else {
|
// } else {
|
||||||
$price = $find['price'];
|
$price = $find['price'];
|
||||||
}
|
// }
|
||||||
$cart_select[$k]['price'] = $price;
|
$cart_select[$k]['price'] = $price;
|
||||||
$cart_select[$k]['cost'] = $find['cost'];
|
$cart_select[$k]['cost'] = $find['cost'];
|
||||||
$cart_select[$k]['vip'] = 0;
|
$cart_select[$k]['vip'] = 0;
|
||||||
|
$cart_select[$k]['unit_name'] = StoreProductUnit::where(['id' => $find['unit']])->value('name')??''; //单位名称
|
||||||
|
|
||||||
//利润
|
//利润
|
||||||
// $cart_select[$k]['profit'] = bcmul($v['cart_num'], $onePrice, 2); //利润
|
// $cart_select[$k]['profit'] = bcmul($v['cart_num'], $onePrice, 2); //利润
|
||||||
$cart_select[$k]['purchase'] = bcmul($v['cart_num'], $find['purchase'], 2) ?? 0; //成本
|
$cart_select[$k]['purchase'] = bcmul($v['cart_num'], $find['purchase'], 2) ?? 0; //成本
|
||||||
$cart_select[$k]['pay_price'] = bcmul($v['cart_num'], $price, 2); //订单支付金额
|
$cart_select[$k]['pay_price'] = bcmul($v['cart_num'], $price, 2); //订单支付金额
|
||||||
$cart_select[$k]['store_price'] = bcmul($v['cart_num'], $find['cost'], 2) ?? 0; //门店零售价
|
$cart_select[$k]['store_price'] = bcmul($v['cart_num'], $find['cost'], 2) ?? 0; //商户价
|
||||||
$cart_select[$k]['vip_price'] = bcmul($v['cart_num'], $find['vip_price'], 2) ?? 0; //vip售价
|
$cart_select[$k]['vip_price'] = bcmul($v['cart_num'], $find['vip_price'], 2) ?? 0; //vip售价
|
||||||
if($cart_select[$k]['total_price']>$cart_select[$k]['pay_price']){
|
if($cart_select[$k]['total_price']>$cart_select[$k]['pay_price']){
|
||||||
$deduction_price=bcsub($cart_select[$k]['total_price'],$cart_select[$k]['pay_price'],2);
|
$deduction_price=bcsub($cart_select[$k]['total_price'],$cart_select[$k]['pay_price'],2);
|
||||||
@ -114,9 +115,17 @@ class OrderLogic extends BaseLogic
|
|||||||
$cart_select[$k]['old_cart_id'] = $v['id'];
|
$cart_select[$k]['old_cart_id'] = $v['id'];
|
||||||
$cart_select[$k]['cart_num'] = $v['cart_num'];
|
$cart_select[$k]['cart_num'] = $v['cart_num'];
|
||||||
$cart_select[$k]['verify_code'] = $params['verify_code'] ?? '';
|
$cart_select[$k]['verify_code'] = $params['verify_code'] ?? '';
|
||||||
//vip1待返回金额
|
$cart_select[$k]['vip_frozen_price']=0;
|
||||||
|
//会员待返回金额
|
||||||
|
if ($user && $off_activity==0){
|
||||||
|
if($user['user_ship']==4){
|
||||||
|
//商户
|
||||||
|
$cart_select[$k]['vip_frozen_price'] = bcsub($cart_select[$k]['pay_price'], $cart_select[$k]['store_price'], 2);
|
||||||
|
}else{
|
||||||
|
//其他会员
|
||||||
$cart_select[$k]['vip_frozen_price'] = bcsub($cart_select[$k]['pay_price'],$cart_select[$k]['vip_price'], 2);
|
$cart_select[$k]['vip_frozen_price'] = bcsub($cart_select[$k]['pay_price'],$cart_select[$k]['vip_price'], 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
// d($cart_select[$k]['pay_price'],$cart_select[$k]['store_price'],$cart_select[$k]['vip_price'] );
|
// d($cart_select[$k]['pay_price'],$cart_select[$k]['store_price'],$cart_select[$k]['vip_price'] );
|
||||||
$cartInfo = $cart_select[$k];
|
$cartInfo = $cart_select[$k];
|
||||||
$cartInfo['name'] = $find['store_name'];
|
$cartInfo['name'] = $find['store_name'];
|
||||||
@ -131,22 +140,17 @@ class OrderLogic extends BaseLogic
|
|||||||
self::$total_price = bcadd(self::$total_price, $cart_select[$k]['total_price'], 2);
|
self::$total_price = bcadd(self::$total_price, $cart_select[$k]['total_price'], 2);
|
||||||
self::$pay_price = bcadd(self::$pay_price, $cart_select[$k]['pay_price'], 2);
|
self::$pay_price = bcadd(self::$pay_price, $cart_select[$k]['pay_price'], 2);
|
||||||
self::$cost = bcadd(self::$cost, $cart_select[$k]['purchase'], 2);
|
self::$cost = bcadd(self::$cost, $cart_select[$k]['purchase'], 2);
|
||||||
self::$store_price = bcadd(self::$store_price, $cart_select[$k]['store_price'], 2); //门店零售价格
|
self::$store_price = bcadd(self::$store_price, $cart_select[$k]['store_price'], 2); //商户价
|
||||||
self::$deduction_price=bcadd(self::$deduction_price,$deduction_price,2);//抵扣金额
|
self::$deduction_price=bcadd(self::$deduction_price,$deduction_price,2);//抵扣金额
|
||||||
// self::$profit = bcadd(self::$profit, $cart_select[$k]['profit'], 2);
|
// self::$profit = bcadd(self::$profit, $cart_select[$k]['profit'], 2);
|
||||||
}
|
}
|
||||||
//加支付方式限制
|
//加支付方式限制
|
||||||
$pay_type = isset($params['pay_type']) ? $params['pay_type'] : 0;
|
// $pay_type = isset($params['pay_type']) ? $params['pay_type'] : 0;
|
||||||
if ($user && $user['user_ship'] == 1 && $pay_type != 17) {
|
// if ($user && $user['user_ship'] == 1 && $pay_type != 17) {
|
||||||
$pay_price = self::$pay_price;
|
// $pay_price = self::$pay_price;
|
||||||
} else {
|
// } else {
|
||||||
$pay_price = bcsub(self::$pay_price, self::$activity_price, 2); //减去活动优惠金额
|
$pay_price = bcsub(self::$pay_price, self::$activity_price, 2); //减去活动优惠金额
|
||||||
}
|
|
||||||
|
|
||||||
// if($pay_price < 500){
|
|
||||||
// throw new Exception('金额低于500');
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
//成本价 收益
|
//成本价 收益
|
||||||
$order = [
|
$order = [
|
||||||
'create_time' => time(),
|
'create_time' => time(),
|
||||||
@ -176,6 +180,22 @@ class OrderLogic extends BaseLogic
|
|||||||
$order['source'] = $params['source'];
|
$order['source'] = $params['source'];
|
||||||
}
|
}
|
||||||
//处理返回最近的店铺
|
//处理返回最近的店铺
|
||||||
|
$store_check = 0;
|
||||||
|
if(empty($user)){
|
||||||
|
$store_id = getenv('STORE_ID') ?? 1;
|
||||||
|
$store['near_store'] =SystemStore::where('id', $store_id)->field('id,name,phone,address,detailed_address,latitude,longitude')->find()??[];
|
||||||
|
}else{
|
||||||
|
$checkOrderStore = StoreOrder::where('uid',$user['id'])->field('id,store_id')
|
||||||
|
->order('id','desc')->find();
|
||||||
|
if($checkOrderStore){
|
||||||
|
$store['near_store'] =SystemStore::where('id', $checkOrderStore['store_id'])->field('id,name,phone,address,detailed_address,latitude,longitude')->find()??[];
|
||||||
|
$store_check = 1;
|
||||||
|
}else{
|
||||||
|
$store_id = getenv('STORE_ID') ?? 1;
|
||||||
|
$store['near_store'] =SystemStore::where('id', $store_id)->field('id,name,phone,address,detailed_address,latitude,longitude')->find()??[];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (empty($store_check)) {
|
||||||
if ((isset($params['lat']) && $params['lat'] != '') && (isset($params['long']) && $params['long'] != '')) {
|
if ((isset($params['lat']) && $params['lat'] != '') && (isset($params['long']) && $params['long'] != '')) {
|
||||||
$storeAll = SystemStore::field('id,name,phone,address,detailed_address,latitude,longitude')->select()->toArray();
|
$storeAll = SystemStore::field('id,name,phone,address,detailed_address,latitude,longitude')->select()->toArray();
|
||||||
$nearestStore = null;
|
$nearestStore = null;
|
||||||
@ -191,9 +211,7 @@ class OrderLogic extends BaseLogic
|
|||||||
if ($nearestStore) {
|
if ($nearestStore) {
|
||||||
$store['near_store'] = $nearestStore;
|
$store['near_store'] = $nearestStore;
|
||||||
}
|
}
|
||||||
}else{
|
}
|
||||||
$store_id = getenv('STORE_ID') ?? 1;
|
|
||||||
$store['near_store'] =SystemStore::where('id', $store_id)->field('id,name,phone,address,detailed_address,latitude,longitude')->find()??[];
|
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
self::setError($e->getMessage());
|
self::setError($e->getMessage());
|
||||||
@ -534,11 +552,7 @@ class OrderLogic extends BaseLogic
|
|||||||
$money = $financeFlow->where(['order_id' => $order['id'], 'financial_pm' => 1, 'financial_type' => 2])->value('number') ?? 0;
|
$money = $financeFlow->where(['order_id' => $order['id'], 'financial_pm' => 1, 'financial_type' => 2])->value('number') ?? 0;
|
||||||
$financeFlowLogic->updateStatusStore($order['id'], $order['store_id'], $money, $deposit);
|
$financeFlowLogic->updateStatusStore($order['id'], $order['store_id'], $money, $deposit);
|
||||||
//积分结算
|
//积分结算
|
||||||
$user_ship=-1;
|
if($order['is_storage']==0&&$order['source']==0){
|
||||||
if($order['uid']){
|
|
||||||
$user_ship=User::where('id',$order['uid'])->value('user_ship');
|
|
||||||
}
|
|
||||||
if($order['is_storage']==0&&$order['source']==0&&in_array($user_ship,[0,4])){
|
|
||||||
UserSignLogic::WriteOff($order);
|
UserSignLogic::WriteOff($order);
|
||||||
}
|
}
|
||||||
Db::commit();
|
Db::commit();
|
||||||
|
@ -63,11 +63,11 @@ class AddressLogic extends BaseLogic
|
|||||||
if($is_default==1){
|
if($is_default==1){
|
||||||
UserAddress::where('uid',$params['uid'])->update(['is_default'=>0]);
|
UserAddress::where('uid',$params['uid'])->update(['is_default'=>0]);
|
||||||
}
|
}
|
||||||
|
$find=UserAddress::where('uid', $params['uid'])->where('id', $params['id'])->find();
|
||||||
$data = [
|
$data = [
|
||||||
'real_name' => $params['real_name'],
|
'real_name' => $params['real_name'],
|
||||||
'phone' => $params['phone'],
|
'phone' => $params['phone'],
|
||||||
'detail' => $params['detail']??'',
|
'detail' => $params['detail']??'',
|
||||||
'is_default' => $params['is_default']??0,
|
|
||||||
'detail' => $params['detail']??'',
|
'detail' => $params['detail']??'',
|
||||||
'is_default' => $params['is_default']??0,
|
'is_default' => $params['is_default']??0,
|
||||||
'province' => $params['province'],
|
'province' => $params['province'],
|
||||||
@ -77,7 +77,14 @@ class AddressLogic extends BaseLogic
|
|||||||
'village' => $params['village'],
|
'village' => $params['village'],
|
||||||
'brigade' => $params['brigade'],
|
'brigade' => $params['brigade'],
|
||||||
];
|
];
|
||||||
|
if($find){
|
||||||
UserAddress::where('uid', $params['uid'])->where('id', $params['id'])->update($data);
|
UserAddress::where('uid', $params['uid'])->where('id', $params['id'])->update($data);
|
||||||
|
}else{
|
||||||
|
$data['is_default']=1;
|
||||||
|
$data['uid']=$params['uid'];
|
||||||
|
UserAddress::create($data);
|
||||||
|
}
|
||||||
|
|
||||||
Db::commit();
|
Db::commit();
|
||||||
return true;
|
return true;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
@ -257,13 +257,13 @@ class UserLogic extends BaseLogic
|
|||||||
switch ($params['type']){
|
switch ($params['type']){
|
||||||
case 1:
|
case 1:
|
||||||
//采购款明细
|
//采购款明细
|
||||||
$categories = ['user_balance_recharge', 'user_order_purchase_pay','system_purchase_add'];
|
$categories = ['user_balance_recharge', 'user_order_purchase_pay','system_purchase_add','user_balance_recharge_refund'];
|
||||||
$query = CapitalFlow::where('uid', $uid)
|
$query = CapitalFlow::where('uid', $uid)
|
||||||
->whereIn('category', $categories);
|
->whereIn('category', $categories);
|
||||||
if($params['mark'] == 1){
|
if(isset($params['mark'])&&$params['mark'] == 1){
|
||||||
$query->where('type','in');
|
$query->where('type','in');
|
||||||
}
|
}
|
||||||
if($params['mark'] == 2){
|
if(isset($params['mark'])&&$params['mark'] == 2){
|
||||||
$query->where('type','out');
|
$query->where('type','out');
|
||||||
}
|
}
|
||||||
$count = $query->count();
|
$count = $query->count();
|
||||||
@ -330,6 +330,15 @@ class UserLogic extends BaseLogic
|
|||||||
->page($params['page_no'],$params['page_size'])
|
->page($params['page_no'],$params['page_size'])
|
||||||
->order('id','desc')
|
->order('id','desc')
|
||||||
->select()->toArray();
|
->select()->toArray();
|
||||||
|
foreach ($data as &$value){
|
||||||
|
if($value['status'] == 0){
|
||||||
|
$value['title'] = "购买商品".$value['all']."元获得".$value['number']."元返还金";
|
||||||
|
}else{
|
||||||
|
//退回到余额、微信、采购款
|
||||||
|
$back = self::dealTitleCate($value['pay_type']);
|
||||||
|
$value['title'] = "返还金解冻".$value['number']."元退回到".$back;
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$data = [];
|
$data = [];
|
||||||
@ -344,5 +353,31 @@ class UserLogic extends BaseLogic
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function dealTitleCate($pay_type)
|
||||||
|
{
|
||||||
|
switch ($pay_type){
|
||||||
|
case 18:
|
||||||
|
$title = "采购款";
|
||||||
|
break;
|
||||||
|
case 17:
|
||||||
|
$title = "现金";
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
$title ="余额";
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
case 9:
|
||||||
|
$title ="微信";
|
||||||
|
break;
|
||||||
|
case 13:
|
||||||
|
$title ="支付宝";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$title ="默认";
|
||||||
|
}
|
||||||
|
return $title;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -171,9 +171,10 @@ class CapitalFlowLogic extends BaseLogic
|
|||||||
return "系统增加采购款{$amount}元";
|
return "系统增加采购款{$amount}元";
|
||||||
case 'system_balance_reduce':
|
case 'system_balance_reduce':
|
||||||
return "系统减少余额{$amount}元";
|
return "系统减少余额{$amount}元";
|
||||||
|
case 'user_balance_recharge_refund':
|
||||||
|
return "用户充值退还{$amount}元";
|
||||||
default:
|
default:
|
||||||
return "订单支付{$amount}元";
|
return "订单支付{$amount}元";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -49,11 +49,9 @@ class CommissionLogic extends BaseLogic
|
|||||||
$user_1 = self::user($order, 0.07, $transaction_id, $order['spread_uid'], 12); //会员、厨师
|
$user_1 = self::user($order, 0.07, $transaction_id, $order['spread_uid'], 12); //会员、厨师
|
||||||
$user_2 = self::user($order, 0.01, $transaction_id, $village_uid, 14); //村长
|
$user_2 = self::user($order, 0.01, $transaction_id, $village_uid, 14); //村长
|
||||||
$user_3 = self::user($order, 0.01, $transaction_id, $brigade_uid, 15); //队长
|
$user_3 = self::user($order, 0.01, $transaction_id, $brigade_uid, 15); //队长
|
||||||
|
|
||||||
$platform = self::platform($order, 0.02, $transaction_id); //平台
|
$platform = self::platform($order, 0.02, $transaction_id); //平台
|
||||||
$store = self::store($order, 0.05, $transaction_id, 0); //门店
|
$store = self::store($order, 0.05, $transaction_id, 0); //门店
|
||||||
$attrition = self::attrition($order, 0.02,$transaction_id,16); //损耗
|
$attrition = self::attrition($order, 0.02,$transaction_id,16); //损耗
|
||||||
|
|
||||||
$moeny = bcadd(bcadd(bcadd(bcadd($user_1, $user_2, 2), $user_3, 2), $platform, 2), bcadd($store, $attrition, 2), 2);
|
$moeny = bcadd(bcadd(bcadd(bcadd($user_1, $user_2, 2), $user_3, 2), $platform, 2), bcadd($store, $attrition, 2), 2);
|
||||||
self::suppliter($order, $moeny, $transaction_id);
|
self::suppliter($order, $moeny, $transaction_id);
|
||||||
}
|
}
|
||||||
@ -79,7 +77,11 @@ class CommissionLogic extends BaseLogic
|
|||||||
$financeLogic = new StoreFinanceFlowLogic();
|
$financeLogic = new StoreFinanceFlowLogic();
|
||||||
$financeLogic->order = $order;
|
$financeLogic->order = $order;
|
||||||
$financeLogic->user['uid'] = $order['uid'];
|
$financeLogic->user['uid'] = $order['uid'];
|
||||||
$fees = bcdiv(bcmul($order['pay_price'], $platformRate, 2), 1, 2);
|
$pay_price = $order['pay_price'];
|
||||||
|
if(isset($order['dealVipAmount']) &&$order['dealVipAmount']>0){
|
||||||
|
$pay_price=bcsub($order['pay_price'],$order['dealVipAmount'],2);
|
||||||
|
}
|
||||||
|
$fees = bcdiv(bcmul($pay_price, $platformRate, 2), 1, 2);
|
||||||
if ($fees > 0) {
|
if ($fees > 0) {
|
||||||
$financeLogic->in($transaction_id, $fees, OrderEnum::ORDER_HANDLING_FEES, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); //平台手续费
|
$financeLogic->in($transaction_id, $fees, OrderEnum::ORDER_HANDLING_FEES, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); //平台手续费
|
||||||
$financeLogic->out($transaction_id, $fees, OrderEnum::ORDER_HANDLING_FEES, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); //商户平台手续费支出
|
$financeLogic->out($transaction_id, $fees, OrderEnum::ORDER_HANDLING_FEES, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); //商户平台手续费支出
|
||||||
@ -95,7 +97,11 @@ class CommissionLogic extends BaseLogic
|
|||||||
$financeLogic = new StoreFinanceFlowLogic();
|
$financeLogic = new StoreFinanceFlowLogic();
|
||||||
$financeLogic->order = $order;
|
$financeLogic->order = $order;
|
||||||
$financeLogic->user['uid'] = $order['uid'];
|
$financeLogic->user['uid'] = $order['uid'];
|
||||||
$fees = bcsub($order['pay_price'], $platformRate, 2);
|
$pay_price = $order['pay_price'];
|
||||||
|
if(isset($order['dealVipAmount']) &&$order['dealVipAmount']>0){
|
||||||
|
$pay_price=bcsub($order['pay_price'],$order['dealVipAmount'],2);
|
||||||
|
}
|
||||||
|
$fees = bcsub($pay_price, $platformRate, 2);
|
||||||
if ($fees > 0) {
|
if ($fees > 0) {
|
||||||
$financeLogic->in($transaction_id, $fees, OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
|
$financeLogic->in($transaction_id, $fees, OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
|
||||||
$financeLogic->out($transaction_id, $fees, OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
|
$financeLogic->out($transaction_id, $fees, OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
|
||||||
@ -116,7 +122,11 @@ class CommissionLogic extends BaseLogic
|
|||||||
//缴纳齐全了就加商户没有就加到平台
|
//缴纳齐全了就加商户没有就加到平台
|
||||||
$money_limt = SystemStore::where('id', $order['store_id'])->field('paid_deposit,security_deposit')->find();
|
$money_limt = SystemStore::where('id', $order['store_id'])->field('paid_deposit,security_deposit')->find();
|
||||||
$deposit = bcsub($money_limt['security_deposit'], $money_limt['paid_deposit'], 2); //保证金剩余额度
|
$deposit = bcsub($money_limt['security_deposit'], $money_limt['paid_deposit'], 2); //保证金剩余额度
|
||||||
$store_profit = bcmul($order['pay_price'], $platformRate, 2);
|
$pay_price = $order['pay_price'];
|
||||||
|
if(isset($order['dealVipAmount']) &&$order['dealVipAmount']>0){
|
||||||
|
$pay_price=bcsub($order['pay_price'],$order['dealVipAmount'],2);
|
||||||
|
}
|
||||||
|
$store_profit = bcmul($pay_price, $platformRate, 2);
|
||||||
if ($deposit > 0) {
|
if ($deposit > 0) {
|
||||||
if ($deposit > $store_profit) {
|
if ($deposit > $store_profit) {
|
||||||
if ($store_profit > 0) {
|
if ($store_profit > 0) {
|
||||||
@ -151,7 +161,11 @@ class CommissionLogic extends BaseLogic
|
|||||||
public static function user($order, $userRate, $transaction_id, $uid = 0, $enum = 0)
|
public static function user($order, $userRate, $transaction_id, $uid = 0, $enum = 0)
|
||||||
{
|
{
|
||||||
$financeLogic = new StoreFinanceFlowLogic();
|
$financeLogic = new StoreFinanceFlowLogic();
|
||||||
$fees = bcmul($order['pay_price'], $userRate, 2);
|
$pay_price = $order['pay_price'];
|
||||||
|
if(isset($order['dealVipAmount']) &&$order['dealVipAmount']>0){
|
||||||
|
$pay_price=bcsub($order['pay_price'],$order['dealVipAmount'],2);
|
||||||
|
}
|
||||||
|
$fees = bcmul($pay_price, $userRate, 2);
|
||||||
if ($fees > 0) {
|
if ($fees > 0) {
|
||||||
//记录用户余额收入
|
//记录用户余额收入
|
||||||
if ($uid) {
|
if ($uid) {
|
||||||
@ -177,7 +191,11 @@ class CommissionLogic extends BaseLogic
|
|||||||
$financeLogic = new StoreFinanceFlowLogic();
|
$financeLogic = new StoreFinanceFlowLogic();
|
||||||
$financeLogic->order = $order;
|
$financeLogic->order = $order;
|
||||||
$financeLogic->user['uid'] = $order['uid'];
|
$financeLogic->user['uid'] = $order['uid'];
|
||||||
$fees = bcmul($order['pay_price'], $userRate, 2);
|
$pay_price = $order['pay_price'];
|
||||||
|
if(isset($order['dealVipAmount']) &&$order['dealVipAmount']>0){
|
||||||
|
$pay_price=bcsub($order['pay_price'],$order['dealVipAmount'],2);
|
||||||
|
}
|
||||||
|
$fees = bcmul($pay_price, $userRate, 2);
|
||||||
if ($fees > 0) {
|
if ($fees > 0) {
|
||||||
SystemStore::where('id', $order['store_id'])->inc('attrition', $fees)->update();
|
SystemStore::where('id', $order['store_id'])->inc('attrition', $fees)->update();
|
||||||
$financeLogic->in($transaction_id, $fees, $enum, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
|
$financeLogic->in($transaction_id, $fees, $enum, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
|
||||||
|
@ -114,9 +114,12 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
];
|
];
|
||||||
OrderLogic::writeOff($params);
|
OrderLogic::writeOff($params);
|
||||||
}
|
}
|
||||||
|
if(in_array($order['shipping_type'],[1,2])){
|
||||||
|
PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
// Redis::send('push-platform-print', ['id' => $order['id']], 60);
|
// Redis::send('push-platform-print', ['id' => $order['id']], 60);
|
||||||
// PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -225,160 +228,10 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
self::dealGoodsLeft($checkArr, $order['uid'], $order['id']);
|
self::dealGoodsLeft($checkArr, $order['uid'], $order['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// $count = UserSign::where([
|
|
||||||
// 'uid'=>$order['uid'],
|
|
||||||
// 'type'=>1,
|
|
||||||
// 'status'=>0
|
|
||||||
// ])->count();
|
|
||||||
//
|
|
||||||
// if($count){
|
|
||||||
// self::addFlowLog($order);
|
|
||||||
// }
|
|
||||||
//收银台下单直接到账
|
|
||||||
// if($order['shipping_type'] == 3){
|
|
||||||
// self::descStock($order['id']);
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// Redis::send('push-platform-print', ['id' => $order['id']], 60);
|
// Redis::send('push-platform-print', ['id' => $order['id']], 60);
|
||||||
// PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']);
|
if(in_array($order['shipping_type'],[1,2])){
|
||||||
|
PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']);
|
||||||
}
|
}
|
||||||
|
|
||||||
//采购款支付后如果有对应的冻结的话就去反对应的log
|
|
||||||
public static function addFlowLog($order)
|
|
||||||
{
|
|
||||||
//查询当前用户有无对应的充值的冻结金额
|
|
||||||
if ($order['uid'] > 0) {
|
|
||||||
$query = UserSign::where([
|
|
||||||
'uid' => $order['uid'],
|
|
||||||
'type' => 1,
|
|
||||||
'status' => 0
|
|
||||||
]);
|
|
||||||
// $query1 = clone $query;
|
|
||||||
// $ids = $query->column('id');
|
|
||||||
$check = $query->sum('number');
|
|
||||||
// $count = $query1->count();
|
|
||||||
if ($check && $check > 0) {
|
|
||||||
$backPurchase = bcmul($order['pay_price'], 0.1, 2);
|
|
||||||
|
|
||||||
// if($count == 1){
|
|
||||||
//存在拆单子否
|
|
||||||
//少了就冻结减去这个对应的金额
|
|
||||||
$one = UserSign::where([
|
|
||||||
'uid' => $order['uid'],
|
|
||||||
'type' => 1,
|
|
||||||
'status' => 0
|
|
||||||
])->find();
|
|
||||||
$data = [
|
|
||||||
'sid' => $one['id'],
|
|
||||||
'uid' => $order['uid'],
|
|
||||||
'order_id' => $order['order_id'],
|
|
||||||
'title' => '充值获得冻结兑换券',
|
|
||||||
'financial_pm' => 1,
|
|
||||||
'type' => 1,
|
|
||||||
'status' => 1,
|
|
||||||
];
|
|
||||||
|
|
||||||
if ($one['number'] >= $backPurchase) {
|
|
||||||
// $wait = bcsub($one['number'],$backPurchase,2)??0;
|
|
||||||
$data['number'] = $backPurchase;
|
|
||||||
|
|
||||||
Db::name('user_sign_log')->insert($data);
|
|
||||||
|
|
||||||
//总的减去采购款百分之十剩余的
|
|
||||||
// if(empty($wait)){
|
|
||||||
// UserSign::where('id',$one['id'])->update(
|
|
||||||
// [
|
|
||||||
// 'number'=>0,
|
|
||||||
// 'status'=>1
|
|
||||||
// ]
|
|
||||||
// );
|
|
||||||
// }else{
|
|
||||||
// //add
|
|
||||||
// UserSign::where('id',$one['id'])->update(
|
|
||||||
// [
|
|
||||||
// 'number'=>$wait
|
|
||||||
// ]
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
//并且加到对应的用户的采购款中
|
|
||||||
// User::where('id',$order['uid'])->inc('purchase_funds',$wait)->update();
|
|
||||||
} else {
|
|
||||||
//对比采购款支付的多少 多了就拿冻结金额即可
|
|
||||||
$data['number'] = $one['number'];
|
|
||||||
//都存到对应的log日志
|
|
||||||
Db::name('user_sign_log')->insert($data);
|
|
||||||
// UserSign::where('id',$one['id'])->update(
|
|
||||||
// [
|
|
||||||
// 'number'=>0,
|
|
||||||
// 'status'=>1
|
|
||||||
// ]
|
|
||||||
// );
|
|
||||||
//并且加到对应的用户的采购款中
|
|
||||||
// User::where('id',$order['uid'])->inc('purchase_funds',$wait)->update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* else{
|
|
||||||
//大于0的时候
|
|
||||||
//先处理金额大的再处理剩余的
|
|
||||||
//把所有的金额改为正的再加一条后再加
|
|
||||||
UserSign::where([
|
|
||||||
'uid'=>$order['uid'],
|
|
||||||
'type'=>1,
|
|
||||||
'status'=>0
|
|
||||||
])->update([
|
|
||||||
'status'=>1,
|
|
||||||
'title'=>json_encode($ids)
|
|
||||||
]);
|
|
||||||
if ($check >= $backPurchase) {
|
|
||||||
//补一条待解冻的
|
|
||||||
$left = bcsub($check,$backPurchase,2);
|
|
||||||
if($left > 0){
|
|
||||||
$data = [
|
|
||||||
'uid' => $order['uid'],
|
|
||||||
'order_id' => $order['order_id'],
|
|
||||||
'title' => '补冻结兑换券',
|
|
||||||
'financial_pm' => 0,
|
|
||||||
'type' => 1,
|
|
||||||
];
|
|
||||||
$data['number'] =$check;
|
|
||||||
$sid = Db::name('user_sign')->insertGetId($data);
|
|
||||||
|
|
||||||
$data = [
|
|
||||||
'uid' => $order['uid'],
|
|
||||||
'sid' => $sid,
|
|
||||||
'order_id' => $order['order_id'],
|
|
||||||
'title' => '充值获得冻结兑换券',
|
|
||||||
'financial_pm' => 1,
|
|
||||||
'type' => 1,
|
|
||||||
];
|
|
||||||
$data['number'] =$backPurchase;
|
|
||||||
Db::name('user_sign_log')->insert($data);
|
|
||||||
}
|
|
||||||
// User::where('id',$order['uid'])->inc('purchase_funds',$backPurchase)->update();//add
|
|
||||||
|
|
||||||
}else{
|
|
||||||
//log
|
|
||||||
$data = [
|
|
||||||
'uid' => $order['uid'],
|
|
||||||
'order_id' => $order['order_id'],
|
|
||||||
'title' => '充值获得冻结兑换券',
|
|
||||||
'financial_pm' => 1,
|
|
||||||
'type' => 1,
|
|
||||||
];
|
|
||||||
$data['number'] =$check;
|
|
||||||
Db::name('user_sign_log')->insert($data);
|
|
||||||
// User::where('id',$order['uid'])->inc('purchase_funds',$check)->update();//add
|
|
||||||
}
|
|
||||||
|
|
||||||
}*/
|
|
||||||
|
|
||||||
// }
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -455,10 +308,10 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
$capitalFlowDao = new CapitalFlowLogic($user);
|
$capitalFlowDao = new CapitalFlowLogic($user);
|
||||||
if ($purchase_funds >= $orderRe['price']) {
|
if ($purchase_funds >= $orderRe['price']) {
|
||||||
User::where('id', $orderRe['uid'])->dec('purchase_funds', $orderRe['refund_price'])->update();
|
User::where('id', $orderRe['uid'])->dec('purchase_funds', $orderRe['refund_price'])->update();
|
||||||
$capitalFlowDao->userExpense('user_order_purchase_pay', 'order', $orderRe['id'], $orderRe['refund_price'], '', 1, $orderRe['store_id']);
|
$capitalFlowDao->userExpense('user_balance_recharge_refund', 'order', $orderRe['id'], $orderRe['refund_price'], '', 1, $orderRe['store_id']);
|
||||||
} else {
|
} else {
|
||||||
User::where('id', $orderRe['uid'])->dec('purchase_funds', $purchase_funds)->update();
|
User::where('id', $orderRe['uid'])->dec('purchase_funds', $purchase_funds)->update();
|
||||||
$capitalFlowDao->userExpense('user_order_purchase_pay', 'order', $orderRe['id'], $purchase_funds, '', 1, $orderRe['store_id']);
|
$capitalFlowDao->userExpense('user_balance_recharge_refund', 'order', $orderRe['id'], $purchase_funds, '', 1, $orderRe['store_id']);
|
||||||
}
|
}
|
||||||
//退还 充值得兑换券
|
//退还 充值得兑换券
|
||||||
UserSignLogic::RefundRecharge($orderRe);
|
UserSignLogic::RefundRecharge($orderRe);
|
||||||
@ -715,6 +568,7 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
$village_uid = 0;
|
$village_uid = 0;
|
||||||
$brigade_uid = 0;
|
$brigade_uid = 0;
|
||||||
$user_ship = 0;
|
$user_ship = 0;
|
||||||
|
$order['dealVipAmount'] = 0;
|
||||||
try {
|
try {
|
||||||
Redis::send('order_wetcha_push_send', ['order' => $order]);
|
Redis::send('order_wetcha_push_send', ['order' => $order]);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@ -729,7 +583,7 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
|
|
||||||
}
|
}
|
||||||
//积分写入
|
//积分写入
|
||||||
if(in_array($user_ship,[0,4])){
|
if(in_array($order['pay_type'],[3,7,9,13,17])&&$order['uid']>0){
|
||||||
UserSignLogic::OrderWrite($order);
|
UserSignLogic::OrderWrite($order);
|
||||||
}
|
}
|
||||||
if ($off_activity == 1) {
|
if ($off_activity == 1) {
|
||||||
@ -743,12 +597,9 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//纯在分销关系的时候要去判断分销出来的用户的采购款的额度 (只有会员按照这个逻辑拆分,其余的还是按照正常的支付金额)
|
//如果是会员需要返回会员金额
|
||||||
if ($user_ship== 1 && $order['pay_type'] != PayEnum::CASH_PAY) {
|
if ($user_ship>0 && $order['pay_type'] != PayEnum::CASH_PAY && $off_activity !=1) {
|
||||||
$vipFrozenAmount = self::dealFrozenPrice($order['id']);
|
$order['dealVipAmount']= self::dealVipAmount($order, $order['pay_type']);
|
||||||
//为1的时候要去减活动价
|
|
||||||
$order['pay_price'] = bcsub($order['pay_price'], $vipFrozenAmount, 2);
|
|
||||||
self::dealVipAmount($order, $order['pay_type']);
|
|
||||||
}
|
}
|
||||||
if ($order['spread_uid'] > 0 || $user_ship > 0) {
|
if ($order['spread_uid'] > 0 || $user_ship > 0) {
|
||||||
if ($order['spread_uid'] > 0 && $user_ship == 0) {
|
if ($order['spread_uid'] > 0 && $user_ship == 0) {
|
||||||
@ -787,8 +638,12 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch ($user_ship) {
|
switch ($user_ship) {
|
||||||
case 1: // 行业会员
|
case 1: // 厨师
|
||||||
case 4: // 商户
|
case 4: // 商户
|
||||||
|
case 5: // 种养殖
|
||||||
|
case 6: // 酒店
|
||||||
|
case 7: // 食堂
|
||||||
|
case 8: // 一条龙
|
||||||
CommissionLogic::setCook($order, $village_uid, $brigade_uid, $transaction_id);
|
CommissionLogic::setCook($order, $village_uid, $brigade_uid, $transaction_id);
|
||||||
break;
|
break;
|
||||||
case 2: // 村长
|
case 2: // 村长
|
||||||
@ -865,6 +720,7 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
'order_sn' => $order['order_id'],
|
'order_sn' => $order['order_id'],
|
||||||
'user_id' => $order['uid'],
|
'user_id' => $order['uid'],
|
||||||
'number' => $total_vip,
|
'number' => $total_vip,
|
||||||
|
'all' => $order['pay_price'],
|
||||||
'pay_type' => $pay_type ?? 1,
|
'pay_type' => $pay_type ?? 1,
|
||||||
'status' => 0,
|
'status' => 0,
|
||||||
'store_id' => $order['store_id'],
|
'store_id' => $order['store_id'],
|
||||||
@ -872,7 +728,7 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
'create_time' => time()
|
'create_time' => time()
|
||||||
];
|
];
|
||||||
Db::name('vip_flow')->insert($data);
|
Db::name('vip_flow')->insert($data);
|
||||||
return true;
|
return $total_vip;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -83,7 +83,7 @@ class PaymentLogic extends BaseLogic
|
|||||||
self::$error = '请使用正确的微信收付款条码';
|
self::$error = '请使用正确的微信收付款条码';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$order = [
|
$data = [
|
||||||
'description' => $description,
|
'description' => $description,
|
||||||
'out_trade_no' => (string)$order['order_id'],
|
'out_trade_no' => (string)$order['order_id'],
|
||||||
'payer' => [
|
'payer' => [
|
||||||
@ -97,10 +97,14 @@ class PaymentLogic extends BaseLogic
|
|||||||
'id' => (string)$order['store_id']??1
|
'id' => (string)$order['store_id']??1
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
'attach'=>'wechat_common'
|
||||||
];
|
];
|
||||||
|
if(isset($order['attach']) && $order['attach']!=''){
|
||||||
|
$data['attach'] = $order['attach'];
|
||||||
|
}
|
||||||
$wechat = new PayService(1);
|
$wechat = new PayService(1);
|
||||||
try {
|
try {
|
||||||
$result = $wechat->wechat->pos($order)->toArray();
|
$result = $wechat->wechat->pos($data)->toArray();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
Log::error('条码支付报错',['message' => $e->extra['message']?? $e->getMessage(),'code'=>$e->getCode()]);
|
Log::error('条码支付报错',['message' => $e->extra['message']?? $e->getMessage(),'code'=>$e->getCode()]);
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ namespace app\common\logic;
|
|||||||
|
|
||||||
use app\common\logic\BaseLogic;
|
use app\common\logic\BaseLogic;
|
||||||
use app\common\model\user\User;
|
use app\common\model\user\User;
|
||||||
|
use app\common\model\user_recharge\UserRecharge;
|
||||||
use app\common\model\user_sign\UserSign;
|
use app\common\model\user_sign\UserSign;
|
||||||
use app\common\model\user_sign_log\UserSignLog;
|
use app\common\model\user_sign_log\UserSignLog;
|
||||||
|
|
||||||
@ -20,9 +21,29 @@ class UserSignLogic extends BaseLogic
|
|||||||
*/
|
*/
|
||||||
public static function dealRechargeFrozen($user, $order, $user_ship = 0)
|
public static function dealRechargeFrozen($user, $order, $user_ship = 0)
|
||||||
{
|
{
|
||||||
$total_vip = bcmul($order['price'], 0.1, 2);
|
$price=(int)$order['price'];
|
||||||
$count = UserSign::where('uid', $order->uid)->count();
|
switch ($price) {
|
||||||
if ($count == 0 && in_array($user_ship, [1, 2, 3, 5, 6, 7, 8])) {
|
case 1000:
|
||||||
|
$total_vip = 249;
|
||||||
|
break;
|
||||||
|
case 2000:
|
||||||
|
$total_vip = 560;
|
||||||
|
break;
|
||||||
|
case 5000:
|
||||||
|
$total_vip = 1550;
|
||||||
|
break;
|
||||||
|
case 10000:
|
||||||
|
$total_vip = 3500;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$total_vip = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if($total_vip==0){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$count = UserRecharge::where('uid', $order->uid)->count();
|
||||||
|
if ($count ==1 && in_array($user_ship, [1, 2, 3, 5, 6, 7, 8])) {
|
||||||
//首充
|
//首充
|
||||||
$write = self::write($order, $total_vip, 0, 1, 9);
|
$write = self::write($order, $total_vip, 0, 1, 9);
|
||||||
self::write_log($write, $total_vip, 0, 7);
|
self::write_log($write, $total_vip, 0, 7);
|
||||||
|
@ -239,6 +239,9 @@ class StoreOrderLogic extends BaseLogic
|
|||||||
$order['refund_status_name'] = OrderEnum::refundStatus($order['refund_status']) ?? '';
|
$order['refund_status_name'] = OrderEnum::refundStatus($order['refund_status']) ?? '';
|
||||||
$order['refund_type_name'] = OrderEnum::refundType($order['refund_type']) ?? '';
|
$order['refund_type_name'] = OrderEnum::refundType($order['refund_type']) ?? '';
|
||||||
$order['pay_type_name'] =PayEnum::getPaySceneDesc($order['pay_type']) ?? '';
|
$order['pay_type_name'] =PayEnum::getPaySceneDesc($order['pay_type']) ?? '';
|
||||||
|
if($order['pay_type'] == PayEnum::PURCHASE_FUNDS && in_array($order['shipping_type'],[1,2])){
|
||||||
|
$order['pay_type_name'] = "采购款";
|
||||||
|
}
|
||||||
if ($order['pay_type'] == 19){
|
if ($order['pay_type'] == 19){
|
||||||
$order['deduction_price'] = "0.00";
|
$order['deduction_price'] = "0.00";
|
||||||
}
|
}
|
||||||
|
34
app/common/model/store_product_gift/StoreProductGift.php
Normal file
34
app/common/model/store_product_gift/StoreProductGift.php
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\common\model\store_product_gift;
|
||||||
|
|
||||||
|
use app\common\model\BaseModel;
|
||||||
|
use app\common\model\store_branch_product\StoreBranchProduct;
|
||||||
|
use app\common\model\store_product\StoreProduct;
|
||||||
|
use app\common\model\system_store\SystemStore;
|
||||||
|
use app\common\model\user\User;
|
||||||
|
use think\model\concern\SoftDelete;
|
||||||
|
|
||||||
|
class StoreProductGift extends BaseModel
|
||||||
|
{
|
||||||
|
use SoftDelete;
|
||||||
|
protected $name = 'store_product_gift';
|
||||||
|
protected $deleteTime = 'delete_time';
|
||||||
|
|
||||||
|
public function store()
|
||||||
|
{
|
||||||
|
return $this->hasOne(SystemStore::class, 'id', 'store_id')
|
||||||
|
->bind(['store_name' => 'name', 'store_phone' => 'phone', 'store_detailed_address' => 'detailed_address', 'store_simple_address' => 'address']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
return $this->hasOne(User::class, 'id', 'uid')->bind(['nickname', 'avatar', 'mobile']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function goodsName()
|
||||||
|
{
|
||||||
|
return $this->hasOne(StoreProduct::class,'id','product_id')->bind(['goods_name'=>'store_name','image','unit','price']);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -69,10 +69,11 @@ class OrderLogic extends BaseLogic
|
|||||||
|
|
||||||
public static function dealFlexiblePrice($where,$start,$end)
|
public static function dealFlexiblePrice($where,$start,$end)
|
||||||
{
|
{
|
||||||
$todayAmount = UserRecharge::where($where)
|
//排除退款
|
||||||
|
$todayAmount = UserRecharge::where($where)->where('status',1)
|
||||||
->whereBetweenTime('create_time', $start, $end)
|
->whereBetweenTime('create_time', $start, $end)
|
||||||
->sum('price');
|
->sum('price');
|
||||||
$pay_price = StoreOrder::where($where)
|
$pay_price = StoreOrder::where($where)->where('refund_status',0)
|
||||||
->whereBetweenTime('create_time', $start, $end)
|
->whereBetweenTime('create_time', $start, $end)
|
||||||
->sum('pay_price');
|
->sum('pay_price');
|
||||||
return bcadd($todayAmount, $pay_price, 2);
|
return bcadd($todayAmount, $pay_price, 2);
|
||||||
|
@ -55,10 +55,10 @@ class StoreCashFinanceFlowController extends BaseAdminController
|
|||||||
{
|
{
|
||||||
$params = (new StoreCashFinanceFlowValidate())->goCheck('detail');
|
$params = (new StoreCashFinanceFlowValidate())->goCheck('detail');
|
||||||
$result = StoreCashFinanceFlowLogic::detail($params);
|
$result = StoreCashFinanceFlowLogic::detail($params);
|
||||||
$result['image']='https://lihaiim.oss-cn-chengdu.aliyuncs.com/public/uploads/images/20240619/20240619104553f7e108704.jpg';
|
$result['image']='https://lihaiim.oss-cn-chengdu.aliyuncs.com/public/uploads/images/20240703/20240703101919cf8429391.jpg';
|
||||||
$result['bank_code']='456565656';
|
$result['bank_code']='22170201040004200';
|
||||||
$result['bank_name']='里海农科';
|
$result['bank_name']='泸县供投里海农业科技有限公司';
|
||||||
$result['bank_address']='泸州支行';
|
$result['bank_address']='中国农业银行股份有限公司泸州石洞支行';
|
||||||
return $this->data($result);
|
return $this->data($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
namespace app\store\controller\store_order;
|
namespace app\store\controller\store_order;
|
||||||
|
|
||||||
use app\admin\logic\user\UserLogic;
|
use app\admin\logic\user\UserLogic;
|
||||||
|
use app\admin\logic\user_ship\UserShipLogic;
|
||||||
use app\api\logic\order\OrderLogic;
|
use app\api\logic\order\OrderLogic;
|
||||||
use app\api\validate\OrderValidate;
|
use app\api\validate\OrderValidate;
|
||||||
use app\common\model\order\Cart;
|
use app\common\model\order\Cart;
|
||||||
@ -398,6 +399,10 @@ class StoreOrderController extends BaseAdminController
|
|||||||
return $this->fail('支付条码不能为空');
|
return $this->fail('支付条码不能为空');
|
||||||
}
|
}
|
||||||
$params = $this->request->post();
|
$params = $this->request->post();
|
||||||
|
UserShipLogic::user_ship($params);
|
||||||
|
if(UserShipLogic::hasError()){
|
||||||
|
return $this->fail(UserShipLogic::getError());
|
||||||
|
}
|
||||||
$data = [
|
$data = [
|
||||||
'store_id' => $this->adminInfo['store_id'],
|
'store_id' => $this->adminInfo['store_id'],
|
||||||
'uid' => $params['uid'],
|
'uid' => $params['uid'],
|
||||||
|
@ -22,10 +22,11 @@ class AddressController extends BaseAdminController
|
|||||||
public function edit()
|
public function edit()
|
||||||
{
|
{
|
||||||
$params = (new UserAddressValidate())->post()->goCheck('edit');
|
$params = (new UserAddressValidate())->post()->goCheck('edit');
|
||||||
if(AddressLogic::edit($params)){
|
AddressLogic::edit($params);
|
||||||
return $this->success('编辑成功');
|
if(AddressLogic::hasError()){
|
||||||
}else{
|
|
||||||
return $this->fail(AddressLogic::getError());
|
return $this->fail(AddressLogic::getError());
|
||||||
|
}else{
|
||||||
|
return $this->success('编辑成功');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -9,6 +9,7 @@ use app\store\controller\BaseAdminController;
|
|||||||
use app\store\lists\user\UserLists;
|
use app\store\lists\user\UserLists;
|
||||||
use app\admin\logic\user\UserLogic;
|
use app\admin\logic\user\UserLogic;
|
||||||
use app\admin\validate\user\UserValidate;
|
use app\admin\validate\user\UserValidate;
|
||||||
|
use app\api\controller\user\UserRechargeController;
|
||||||
use app\common\model\user\User;
|
use app\common\model\user\User;
|
||||||
use support\Cache;
|
use support\Cache;
|
||||||
|
|
||||||
@ -34,7 +35,6 @@ class UserController extends BaseAdminController
|
|||||||
return $this->success('发送成功');
|
return $this->success('发送成功');
|
||||||
}
|
}
|
||||||
return $this->fail('发送失败');
|
return $this->fail('发送失败');
|
||||||
|
|
||||||
}
|
}
|
||||||
public function add()
|
public function add()
|
||||||
{
|
{
|
||||||
@ -55,7 +55,6 @@ class UserController extends BaseAdminController
|
|||||||
return $this->fail(UserLogic::getError());
|
return $this->fail(UserLogic::getError());
|
||||||
}
|
}
|
||||||
return $this->success('添加成功', [], 1, 1);
|
return $this->success('添加成功', [], 1, 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function detail()
|
public function detail()
|
||||||
@ -65,7 +64,8 @@ class UserController extends BaseAdminController
|
|||||||
return $this->success('', $detail);
|
return $this->success('', $detail);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function user_ship(){
|
public function user_ship()
|
||||||
|
{
|
||||||
$user_ship = $this->request->post('user_ship', 0);
|
$user_ship = $this->request->post('user_ship', 0);
|
||||||
$id = $this->request->post('id', 0);
|
$id = $this->request->post('id', 0);
|
||||||
if ($user_ship == 1) {
|
if ($user_ship == 1) {
|
||||||
@ -75,7 +75,8 @@ class UserController extends BaseAdminController
|
|||||||
return $this->success('设置成功');
|
return $this->success('设置成功');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function user_label(){
|
public function user_label()
|
||||||
|
{
|
||||||
$label_id = $this->request->post('label_id', 0);
|
$label_id = $this->request->post('label_id', 0);
|
||||||
$id = $this->request->post('id', 0);
|
$id = $this->request->post('id', 0);
|
||||||
|
|
||||||
@ -83,4 +84,8 @@ class UserController extends BaseAdminController
|
|||||||
return $this->success('设置成功');
|
return $this->success('设置成功');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function recharge_list()
|
||||||
|
{
|
||||||
|
return (new UserRechargeController())->recharge_list();
|
||||||
|
}
|
||||||
}
|
}
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
namespace app\store\controller\user;
|
namespace app\store\controller\user;
|
||||||
|
|
||||||
|
use app\admin\logic\user_ship\UserShipLogic;
|
||||||
use app\store\controller\BaseAdminController;
|
use app\store\controller\BaseAdminController;
|
||||||
use app\common\lists\user\UserShipLists;
|
use app\common\lists\user\UserShipLists;
|
||||||
|
|
||||||
@ -15,4 +15,14 @@ class UserShipController extends BaseAdminController
|
|||||||
{
|
{
|
||||||
return $this->dataLists(new UserShipLists());
|
return $this->dataLists(new UserShipLists());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function is_user_ship(){
|
||||||
|
$data=$this->request->post();
|
||||||
|
UserShipLogic::user_ship($data);
|
||||||
|
if(UserShipLogic::hasError()){
|
||||||
|
return $this->fail(UserShipLogic::getError());
|
||||||
|
}else{
|
||||||
|
return $this->success('ok');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -48,8 +48,8 @@ class StoreOrderLists extends BaseAdminDataLists implements ListsSearchInterface
|
|||||||
{
|
{
|
||||||
$store_id = $this->adminInfo['store_id'] ?? 5;
|
$store_id = $this->adminInfo['store_id'] ?? 5;
|
||||||
$is_sashier = $this->request->get('is_sashier');
|
$is_sashier = $this->request->get('is_sashier');
|
||||||
if ($is_sashier == 1) { //收银台订单
|
|
||||||
$this->searchWhere[] = ['store_id', '=', $store_id];
|
$this->searchWhere[] = ['store_id', '=', $store_id];
|
||||||
|
if ($is_sashier == 1) { //收银台订单
|
||||||
$this->searchWhere[] = ['source', '=', 1];
|
$this->searchWhere[] = ['source', '=', 1];
|
||||||
} elseif ($is_sashier == 2) { //小程序订单
|
} elseif ($is_sashier == 2) { //小程序订单
|
||||||
$this->searchWhere[] = ['source', '=', 0];
|
$this->searchWhere[] = ['source', '=', 0];
|
||||||
@ -74,7 +74,7 @@ class StoreOrderLists extends BaseAdminDataLists implements ListsSearchInterface
|
|||||||
->field(['id', 'order_id', 'pay_price', 'pay_time','uid', 'pay_type', 'status', 'paid', 'total_num'])
|
->field(['id', 'order_id', 'pay_price', 'pay_time','uid', 'pay_type', 'status', 'paid', 'total_num'])
|
||||||
->limit($this->limitOffset, $this->limitLength)
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
->order(['id' => 'desc'])
|
->order(['id' => 'desc'])
|
||||||
->select()->each(function ($item) use ($store_id) {
|
->select()->each(function ($item){
|
||||||
if (empty($item['pay_time'])) {
|
if (empty($item['pay_time'])) {
|
||||||
$item['pay_time'] = '';
|
$item['pay_time'] = '';
|
||||||
}else{
|
}else{
|
||||||
|
@ -602,7 +602,7 @@ class WorkbenchLogic extends BaseLogic
|
|||||||
|
|
||||||
//当日营业额的统计
|
//当日营业额的统计
|
||||||
$today = StoreOrder::where(['paid' => YesNoEnum::YES, 'store_id' => $params['store_id']]);
|
$today = StoreOrder::where(['paid' => YesNoEnum::YES, 'store_id' => $params['store_id']]);
|
||||||
$turnover_today = $today
|
$turnover_today = $today->where('refund_status',0)
|
||||||
->whereDay('create_time')
|
->whereDay('create_time')
|
||||||
->sum('pay_price');
|
->sum('pay_price');
|
||||||
//当日利润的统计
|
//当日利润的统计
|
||||||
@ -629,6 +629,7 @@ class WorkbenchLogic extends BaseLogic
|
|||||||
//总的营业额的统计 总的利润的统计 总的成本合集的统计 总的加到保证金的
|
//总的营业额的统计 总的利润的统计 总的成本合集的统计 总的加到保证金的
|
||||||
$all = StoreOrder::where(['paid' => YesNoEnum::YES, 'store_id' => $params['store_id']]);
|
$all = StoreOrder::where(['paid' => YesNoEnum::YES, 'store_id' => $params['store_id']]);
|
||||||
$deposit_all = StoreFinanceFlow::where(['store_id' => $params['store_id'], 'status' => YesNoEnum::YES])
|
$deposit_all = StoreFinanceFlow::where(['store_id' => $params['store_id'], 'status' => YesNoEnum::YES])
|
||||||
|
->where('financial_type', OrderEnum::ORDER_MARGIN)
|
||||||
->sum('number');
|
->sum('number');
|
||||||
|
|
||||||
$cash_all = StoreCashFinanceFlow::where('store_id', $params['store_id'])
|
$cash_all = StoreCashFinanceFlow::where('store_id', $params['store_id'])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user