5.22更新
This commit is contained in:
parent
c9d5fbabda
commit
d06160776f
@ -117,6 +117,20 @@ class MerchantController extends BaseAdminController
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 设置余额
|
||||
*/
|
||||
public function set_money()
|
||||
{
|
||||
$set_money = $this->request->post('set_money', 0);
|
||||
$id = $this->request->post('mer_id', 0);
|
||||
$type = $this->request->post('type', 1);
|
||||
$result = MerchantLogic::set_money($id, $set_money, $type);
|
||||
if (true === $result) {
|
||||
return $this->success('设置成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(MerchantLogic::getError());
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取商户列表详情
|
||||
@ -131,6 +145,29 @@ class MerchantController extends BaseAdminController
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 绑定用户
|
||||
*/
|
||||
public function bind_user()
|
||||
{
|
||||
$params = $this->request->post();
|
||||
if (!isset($params['mer_id']) && !isset($params['uid'])) {
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
$find = Merchant::where('uid', $params['uid'])->find();
|
||||
if ($find) {
|
||||
return $this->fail('该用户已绑定商户');
|
||||
}
|
||||
$res = Merchant::where('mer_id', $params['mer_id'])->update(['uid' => $params['uid']]);
|
||||
if ($res) {
|
||||
return $this->success('绑定成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail('绑定失败');
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 绑定商品
|
||||
*/
|
||||
public function bind_goods()
|
||||
{
|
||||
$params = (new MerchantValidate())->post()->goCheck('detail');
|
||||
@ -141,6 +178,9 @@ class MerchantController extends BaseAdminController
|
||||
return $this->fail(MerchantLogic::getError());
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 商品列表
|
||||
*/
|
||||
public function bind_goods_lists()
|
||||
{
|
||||
$mer_id = $this->request->get('mer_id');
|
||||
|
@ -96,6 +96,19 @@ class SupplierController extends BaseAdminController
|
||||
return $this->fail(SupplierLogic::getError());
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 设置余额
|
||||
*/
|
||||
public function set_money(){
|
||||
$set_money = $this->request->post('set_money',0);
|
||||
$id=$this->request->post('id',0);
|
||||
$type=$this->request->post('type',1);
|
||||
$result = SupplierLogic::set_money($id,$set_money,$type);
|
||||
if (true === $result) {
|
||||
return $this->success('设置成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(SupplierLogic::getError());
|
||||
}
|
||||
/**
|
||||
* @notes 删除供应商管理
|
||||
* @return \think\response\Json
|
||||
|
@ -4,8 +4,10 @@ namespace app\admin\logic\merchant;
|
||||
|
||||
use app\admin\logic\user\UserLogic;
|
||||
use app\admin\service\JgPushService;
|
||||
use app\common\enum\OrderEnum;
|
||||
use app\common\model\merchant\Merchant;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\financial\FinancialRecord;
|
||||
use app\common\model\user\User;
|
||||
use think\facade\Db;
|
||||
use support\exception\BusinessException;
|
||||
@ -190,7 +192,57 @@ class MerchantLogic extends BaseLogic
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 设置余额
|
||||
*/
|
||||
public static function set_money($id,$set_money,$type=1){
|
||||
Db::startTrans();
|
||||
try {
|
||||
if($type==1){
|
||||
Merchant::where('mer_id',$id)->inc('mer_money',$set_money)->update();
|
||||
$record = [
|
||||
'financial_record_sn' => time(),
|
||||
'order_id' => 0,
|
||||
'number_sn' =>getNewOrderId('XTCZ') ,
|
||||
'user_id' => 0,
|
||||
'financial_type' => OrderEnum::SYSTEM_SET,
|
||||
'financial_pm' => OrderEnum::INCOME,
|
||||
'number' => $set_money,
|
||||
'status' => 1,
|
||||
'type' => OrderEnum::MERCHANT,
|
||||
'mer_id' => $id,
|
||||
];
|
||||
FinancialRecord::create($record);
|
||||
}else{
|
||||
$money=Merchant::where('mer_id',$id)->value('mer_money');
|
||||
if($money<$set_money){
|
||||
Db::rollback();
|
||||
self::setError('余额不足');
|
||||
return false;
|
||||
}
|
||||
Merchant::where('mer_id',$id)->dec('mer_money',$set_money)->update();
|
||||
$record = [
|
||||
'financial_record_sn' => time(),
|
||||
'order_id' => 0,
|
||||
'number_sn' =>getNewOrderId('XTJS') ,
|
||||
'user_id' => 0,
|
||||
'financial_type' => OrderEnum::SYSTEM_SET,
|
||||
'financial_pm' => OrderEnum::EXPENDITURE,
|
||||
'number' => $set_money,
|
||||
'status' => 1,
|
||||
'type' => OrderEnum::MERCHANT,
|
||||
'mer_id' => $id,
|
||||
];
|
||||
FinancialRecord::create($record);
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @notes 商户绑定商品
|
||||
* @param array $params
|
||||
|
@ -196,30 +196,36 @@ class OpurchaseclassLogic extends BaseLogic
|
||||
public static function createSupplierGoods($goods)
|
||||
{
|
||||
try {
|
||||
$supplier_arr=SupplierBindGoods::where('goods_id')->column('supplier_id');
|
||||
if($supplier_arr){
|
||||
$supplier_arr=array_unique($supplier_arr);
|
||||
foreach ($supplier_arr as $k => $v) {
|
||||
$goods_offer[] = [
|
||||
'supplier_id' => $v['id'],
|
||||
'goods_id' => $goods['goods'],
|
||||
'order_id' => $goods['pid'],
|
||||
'price' => 0,
|
||||
'need_num' => $goods['nums'],
|
||||
'create_time'=>time()
|
||||
];
|
||||
}
|
||||
if (count($goods_offer) >= 1) {
|
||||
$res = OpurchaseGoodsOffer::insertAll($goods_offer);
|
||||
if ($res) {
|
||||
Opurchaseinfo::where('id',$goods['id'])->update(['is_push'=>1]);
|
||||
return $goods_offer;
|
||||
$supplier_arr = SupplierBindGoods::where('goods_id')->column('supplier_id');
|
||||
if ($supplier_arr) {
|
||||
$supplier_arr = array_unique($supplier_arr);
|
||||
$time=strtotime(date('Y-m-d',time()));
|
||||
foreach ($supplier_arr as $k => $v) {
|
||||
$goods_offer[] = [
|
||||
'supplier_id' => $v['id'],
|
||||
'goods_id' => $goods['goods'],
|
||||
'order_id' => $goods['pid'],
|
||||
'price' => 0,
|
||||
'need_num' => $goods['nums'],
|
||||
'create_time' => time()
|
||||
];
|
||||
$find=Db::name('opurchase_goods_offer_date')->where('supplier_id',$v)->where('create_time',$time)->find();
|
||||
if($find){
|
||||
Db::name('opurchase_goods_offer_date')->where('id',$find['id'])->inc('nums')->update();
|
||||
}else{
|
||||
$data=['supplier_id'=>$v,'nums'=>1,'create_time'=>$time];
|
||||
Db::name('opurchase_goods_offer_date')->insert($data);
|
||||
}
|
||||
}
|
||||
if (count($goods_offer) >= 1) {
|
||||
$res = OpurchaseGoodsOffer::insertAll($goods_offer);
|
||||
if ($res) {
|
||||
Opurchaseinfo::where('id', $goods['id'])->update(['is_push' => 1]);
|
||||
return $goods_offer;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
}else{
|
||||
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
self::setError($e->getMessage());
|
||||
Log::error('添加采购订单报价失败:' . $e->getMessage());
|
||||
|
@ -4,10 +4,12 @@ namespace app\admin\logic\supplier;
|
||||
|
||||
use app\admin\logic\user\UserLogic;
|
||||
use app\admin\service\JgPushService;
|
||||
use app\common\enum\OrderEnum;
|
||||
use app\common\model\goods\GoodsLabel;
|
||||
use app\common\model\merchant\MerchantBank;
|
||||
use app\common\model\supplier\Supplier;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\financial\FinancialRecord;
|
||||
use think\facade\Db;
|
||||
use support\exception\BusinessException;
|
||||
|
||||
@ -199,6 +201,57 @@ class SupplierLogic extends BaseLogic
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 设置余额
|
||||
*/
|
||||
public static function set_money($id,$set_money,$type=1){
|
||||
Db::startTrans();
|
||||
try {
|
||||
if($type==1){
|
||||
Supplier::where('id',$id)->inc('mer_money',$set_money)->update();
|
||||
$record = [
|
||||
'financial_record_sn' => time(),
|
||||
'order_id' => 0,
|
||||
'number_sn' =>getNewOrderId('XTCZ') ,
|
||||
'user_id' => 0,
|
||||
'financial_type' => OrderEnum::SYSTEM_SET,
|
||||
'financial_pm' => OrderEnum::INCOME,
|
||||
'number' => $set_money,
|
||||
'status' => 1,
|
||||
'type' => OrderEnum::SUPPLIER,
|
||||
'mer_id' => $id,
|
||||
];
|
||||
FinancialRecord::create($record);
|
||||
}else{
|
||||
$money=Supplier::where('id',$id)->value('mer_money');
|
||||
if($money<$set_money){
|
||||
Db::rollback();
|
||||
self::setError('余额不足');
|
||||
return false;
|
||||
}
|
||||
Supplier::where('id',$id)->dec('mer_money',$set_money)->update();
|
||||
$record = [
|
||||
'financial_record_sn' => time(),
|
||||
'order_id' => 0,
|
||||
'number_sn' =>getNewOrderId('XTJS') ,
|
||||
'user_id' => 0,
|
||||
'financial_type' => OrderEnum::SYSTEM_SET,
|
||||
'financial_pm' => OrderEnum::EXPENDITURE,
|
||||
'number' => $set_money,
|
||||
'status' => 1,
|
||||
'type' => OrderEnum::SUPPLIER,
|
||||
'mer_id' => $id,
|
||||
];
|
||||
FinancialRecord::create($record);
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 删除供应商管理
|
||||
|
@ -26,16 +26,15 @@ class IndexController extends BaseApiController
|
||||
|
||||
public function index()
|
||||
{
|
||||
$client = new JPush($app_key, $master_secret);
|
||||
// $client = new JPush($app_key, $master_secret);
|
||||
|
||||
$client->push()
|
||||
->setPlatform('all')
|
||||
->addAllAudience()
|
||||
->setNotificationAlert('Hello, JPush')
|
||||
->send();
|
||||
// $client->push()
|
||||
// ->setPlatform('all')
|
||||
// ->addAllAudience()
|
||||
// ->setNotificationAlert('Hello, JPush')
|
||||
// ->send();
|
||||
|
||||
|
||||
d($token);
|
||||
// var_dump(2323);
|
||||
return json(['msg' =>create_password(123456, '11d3')]);
|
||||
// PushService::push('store_merchant_502', 502, '支付超时,订单已被取消,请重新提交订单');
|
||||
|
44
app/api/controller/financial/FinancialRecordController.php
Normal file
44
app/api/controller/financial/FinancialRecordController.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller\financial;
|
||||
|
||||
|
||||
use app\api\controller\BaseApiController;
|
||||
use app\api\lists\financial\FinancialRecordLists;
|
||||
|
||||
/**
|
||||
* 商品分类控制器
|
||||
* Class GoodsclassController
|
||||
* @package app\admin\controller\goods
|
||||
*/
|
||||
class FinancialRecordController extends BaseApiController
|
||||
{
|
||||
/**
|
||||
* @notes 获取商户流水统计
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/04/23 10:27
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
$start_time = $this->request->get('start_time');
|
||||
$end_time = $this->request->get('end_time');
|
||||
if(!isset($start_time)||!isset($end_time)){
|
||||
return $this->fail('请选择时间');
|
||||
}
|
||||
$start_time = strtotime($start_time); // 开始时间
|
||||
$end_time = strtotime($end_time); // 结束时间
|
||||
|
||||
// 计算时间差
|
||||
$time_diff = $end_time - $start_time;
|
||||
|
||||
// 7天内的秒数
|
||||
$seven_days_in_seconds = 7 * 24 * 60 * 60;
|
||||
|
||||
// 验证时间差是否在7天内
|
||||
if ($time_diff > $seven_days_in_seconds) {
|
||||
return $this->fail('时间差不能超过7天');
|
||||
}
|
||||
return $this->dataLists((new FinancialRecordLists));
|
||||
}
|
||||
}
|
@ -2,14 +2,76 @@
|
||||
|
||||
namespace app\api\controller\merchant;
|
||||
|
||||
use app\admin\validate\withdraw\MerchantWithdrawValidate;
|
||||
use app\api\lists\merchant\MerchantLists;
|
||||
|
||||
use app\api\controller\BaseApiController;
|
||||
|
||||
use app\api\lists\withdraw\MerchantWithdrawLists;
|
||||
use app\api\logic\merchant\MerchantLogic;
|
||||
|
||||
class MerchantController extends BaseApiController
|
||||
{
|
||||
public function lists(){
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new MerchantLists());
|
||||
}
|
||||
}
|
||||
//提现列表
|
||||
public function taking_lists()
|
||||
{
|
||||
return $this->dataLists(new MerchantWithdrawLists());
|
||||
}
|
||||
//获取用户余额和绑定银行账户信息
|
||||
public function amount_account()
|
||||
{
|
||||
$merchant = $this->request->userInfo['merchant'];
|
||||
if (!$merchant) {
|
||||
return $this->fail('当前用户非商户');
|
||||
}
|
||||
if (!$merchant->isEmpty()) {
|
||||
$res=MerchantLogic::amount_account($merchant);
|
||||
if(MerchantLogic::hasError()){
|
||||
return $this->fail(MerchantLogic::getError());
|
||||
}
|
||||
return $this->success('获取成功',$res);
|
||||
}
|
||||
return $this->fail('获取失败');
|
||||
}
|
||||
|
||||
//用户提现操作
|
||||
public function withdraw()
|
||||
{
|
||||
$params = (new MerchantWithdrawValidate())->post()->goCheck('withdraw');
|
||||
$merchant = $this->request->userInfo['merchant'];
|
||||
if (!$merchant) {
|
||||
return $this->fail('当前用户非商户');
|
||||
}
|
||||
if (!$merchant->isEmpty()) {
|
||||
MerchantLogic::withdraw($params,$merchant);
|
||||
if(MerchantLogic::hasError()){
|
||||
return $this->fail(MerchantLogic::getError());
|
||||
}
|
||||
return $this->success('提现成功,等待管理员审核');
|
||||
}
|
||||
return $this->fail('提现异常');
|
||||
}
|
||||
|
||||
/**
|
||||
* 提现信息
|
||||
*/
|
||||
public function taking_info()
|
||||
{
|
||||
$merchant = $this->request->userInfo['merchant'];
|
||||
if (!$merchant) {
|
||||
return $this->fail('当前用户非商户');
|
||||
}
|
||||
|
||||
if (!$merchant->isEmpty()) {
|
||||
$res=MerchantLogic::taking_info($merchant);
|
||||
if(MerchantLogic::hasError()){
|
||||
return $this->fail(MerchantLogic::getError());
|
||||
}
|
||||
return $this->success('ok',$res);
|
||||
}
|
||||
return $this->success('ok');
|
||||
}
|
||||
}
|
||||
|
77
app/api/lists/financial/FinancialRecordLists.php
Normal file
77
app/api/lists/financial/FinancialRecordLists.php
Normal file
@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\lists\financial;
|
||||
|
||||
|
||||
use app\admin\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\financial\FinancialRecord;
|
||||
|
||||
/**
|
||||
* 商户财务记录列表
|
||||
* Class GoodsclassLists
|
||||
* @package app\admin\listsgoods
|
||||
*/
|
||||
class FinancialRecordLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
protected $where;
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2024/04/23 10:27
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['financial_pm'],
|
||||
"between_time" => 'create_time'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取商户财务记列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2024/04/23 10:27
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$mer_id = $this->request->userInfo['merchant']['mer_id'] ?? 0;
|
||||
if ($mer_id <= 0) {
|
||||
return [];
|
||||
}
|
||||
$where = [
|
||||
'type' => 1,
|
||||
'mer_id' => $mer_id,
|
||||
];
|
||||
$this->where = $where;
|
||||
$list = FinancialRecord::where($this->searchWhere)
|
||||
->where($where)
|
||||
->field("FROM_UNIXTIME(create_time, '%Y-%m-%d') as record_date, SUM(number) as total_amount")
|
||||
->group('record_date')
|
||||
->order('record_date')
|
||||
->select();
|
||||
return $list?->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取商户财务记数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2024/04/23 10:27
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
|
||||
return FinancialRecord::where($this->searchWhere)
|
||||
->where($this->where)
|
||||
->count();
|
||||
}
|
||||
}
|
@ -53,7 +53,8 @@ class MerchantLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
) ASC ");
|
||||
}
|
||||
return Merchant::where($this->searchWhere)
|
||||
->field('mer_id,mer_name,long,lat,service_phone,mer_address')
|
||||
->with(['realName'])
|
||||
->field('mer_id,mer_name,long,lat,service_phone,mer_address,uid')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order($order)
|
||||
->select()
|
||||
|
78
app/api/logic/merchant/MerchantLogic.php
Normal file
78
app/api/logic/merchant/MerchantLogic.php
Normal file
@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\logic\merchant;
|
||||
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\bank\Bank;
|
||||
use app\common\model\merchant\Merchant;
|
||||
use app\common\model\merchant\MerchantBank;
|
||||
use app\common\model\withdraw\MerchantWithdraw;
|
||||
use think\facade\Db;
|
||||
|
||||
class MerchantLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* 获取用户余额和绑定银行账户信息
|
||||
*/
|
||||
public static function amount_account($merchant)
|
||||
{
|
||||
try {
|
||||
|
||||
$bank_list = MerchantBank::where('mer_id', $merchant['mer_id'])->where('is_check', 1)->select()->each(function ($data) {
|
||||
$bank_info = Bank::where('id', $data['bank_id'])->findOrEmpty();
|
||||
$data['bank_name'] = !$bank_info->isEmpty() ? $bank_info['name'] : '';
|
||||
$data['bank_image'] = !$bank_info->isEmpty() ? $bank_info['image'] : '';
|
||||
return $data;
|
||||
})->toArray();
|
||||
return $bank_list;
|
||||
} catch (\Exception $e) {
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户提现操作
|
||||
*/
|
||||
public static function withdraw($params, $merchant)
|
||||
{
|
||||
try {
|
||||
$merchant = Merchant::where('mer_id', $merchant['mer_id'])->find();
|
||||
if ($params['amount'] > $merchant['mer_money']) {
|
||||
self::setError('提现余额不足');
|
||||
return false;
|
||||
}
|
||||
$save_data = [
|
||||
'mer_id' => $merchant['mer_id'],
|
||||
'merchant_bank_id' => $params['merchant_bank_id'],
|
||||
'amount' => $params['amount'],
|
||||
'is_check' => 0,
|
||||
'is_arrival' => 0,
|
||||
'admin_id' => 0,
|
||||
'create_time' => time(),
|
||||
];
|
||||
(new MerchantWithdraw)->save($save_data);
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 提现信息
|
||||
*/
|
||||
public static function taking_info($merchant){
|
||||
try {
|
||||
$total_amount = MerchantWithdraw::where('mer_id', $merchant['mer_id'])->where('is_check', 1)->where('is_arrival', 1)->sum('amount');
|
||||
$count = MerchantWithdraw::where('mer_id', $merchant['mer_id'])->where('is_check', 1)->where('is_arrival', 1)->count();
|
||||
return ['total' => $total_amount, 'count' => $count];
|
||||
} catch (\Exception $e) {
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -15,6 +15,7 @@ class OrderEnum
|
||||
* @PLATFORM_ORDER_OBTAINS 平台订单获得
|
||||
* @SUPPLIER_ORDER_OBTAINS 供应链订单获得
|
||||
* @PLATFORM_ORDER_PAY 平台订单支付
|
||||
* @SYSTEM_SET 系统设置
|
||||
*/
|
||||
const USER_ORDER_PAY = 1;
|
||||
const MERCHANT_ORDER_OBTAINS = 2;
|
||||
@ -23,6 +24,7 @@ class OrderEnum
|
||||
const PLATFORM_ORDER_OBTAINS = 5;
|
||||
const SUPPLIER_ORDER_OBTAINS = 6;
|
||||
const PLATFORM_ORDER_PAY = 7;
|
||||
const SYSTEM_SET = 8;
|
||||
|
||||
|
||||
/**
|
||||
@ -39,11 +41,13 @@ class OrderEnum
|
||||
* @MERCHANT 商户
|
||||
* @PLATFORM 平台
|
||||
* @SUPPLIER 供应链
|
||||
* @SYSTEM 系统
|
||||
*/
|
||||
const USER =0;
|
||||
const MERCHANT =1;
|
||||
const PLATFORM =2;
|
||||
const SUPPLIER =3;
|
||||
const SYSTEM=4;
|
||||
|
||||
/**
|
||||
* @notes 获取支付类型
|
||||
|
@ -8,7 +8,7 @@ use think\model\concern\SoftDelete;
|
||||
|
||||
|
||||
/**
|
||||
* 采购订单模型
|
||||
* 财务流水模型
|
||||
* Class FinancialRecord
|
||||
* @package app\common\model\FinancialRecord
|
||||
*/
|
||||
|
@ -4,6 +4,7 @@ namespace app\common\model\merchant;
|
||||
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use app\common\model\user\User;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
|
||||
@ -19,5 +20,8 @@ class Merchant extends BaseModel
|
||||
protected $name = 'merchant';
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
|
||||
public function realName()
|
||||
{
|
||||
return $this->hasOne(User::class,'id','uid')->bind(['mer_real_name'=>'real_name']);
|
||||
}
|
||||
}
|
@ -313,3 +313,18 @@ if (!function_exists('base64UrlDecode')) {
|
||||
return base64_decode($base64Padded);
|
||||
}
|
||||
}
|
||||
if (!function_exists('getNewOrderId')) {
|
||||
|
||||
/**
|
||||
* @notes 获取订单号
|
||||
* @param $type
|
||||
* @return string
|
||||
*/
|
||||
function getNewOrderId($type)
|
||||
{
|
||||
list($msec, $sec) = explode(' ', microtime());
|
||||
$msectime = number_format((floatval($msec) + floatval($sec)) * 1000, 0, '', '');
|
||||
$orderId = $type . $msectime . mt_rand(10000, max(intval($msec * 10000) + 10000, 98369));
|
||||
return $orderId;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user