commit
7dd46d13a5
@ -62,7 +62,18 @@ class StoreExtractController extends BaseAdminController
|
|||||||
}
|
}
|
||||||
return $this->fail(StoreExtractLogic::getError());
|
return $this->fail(StoreExtractLogic::getError());
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @notes 确认提现
|
||||||
|
* @return \think\response\Json
|
||||||
|
* @author admin
|
||||||
|
* @date 2024/05/31 17:09
|
||||||
|
*/
|
||||||
|
public function enter()
|
||||||
|
{
|
||||||
|
$params = $this->request->post();
|
||||||
|
$result = StoreExtractLogic::Enter($params);
|
||||||
|
return $this->success('提现成功', [], 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notes 删除门店提现
|
* @notes 删除门店提现
|
||||||
|
@ -23,7 +23,7 @@ class UserController extends BaseAdminController
|
|||||||
return $this->dataLists(new UserLists());
|
return $this->dataLists(new UserLists());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notes 添加用户列表
|
* @notes 添加用户列表
|
||||||
* @return \think\response\Json
|
* @return \think\response\Json
|
||||||
* @author likeadmin
|
* @author likeadmin
|
||||||
@ -61,17 +61,17 @@ class UserController extends BaseAdminController
|
|||||||
{
|
{
|
||||||
// $params = (new UserValidate())->post()->goCheck('edit');
|
// $params = (new UserValidate())->post()->goCheck('edit');
|
||||||
$params = $this->request->post();
|
$params = $this->request->post();
|
||||||
$result = UserLogic::edit($params);
|
$result = UserLogic::edit($params);
|
||||||
if (true === $result) {
|
if (true === $result) {
|
||||||
return $this->success('编辑成功', [], 1, 1);
|
return $this->success('编辑成功', [], 1, 1);
|
||||||
}
|
}
|
||||||
return $this->fail(UserLogic::getError());
|
return $this->fail(UserLogic::getError());
|
||||||
}
|
}
|
||||||
|
|
||||||
//采购款明细、余额明细、礼品券明细、返还金明细
|
//采购款明细、余额明细、礼品券明细、返还金明细
|
||||||
public function fundList()
|
public function fundList()
|
||||||
{
|
{
|
||||||
(new UserValidate())->get()->goCheck('fund');
|
(new UserValidate())->get()->goCheck('fund');
|
||||||
$page_no = (int)$this->request->get('page_no', 1);
|
$page_no = (int)$this->request->get('page_no', 1);
|
||||||
$page_size = (int)$this->request->get('page_size', 15);
|
$page_size = (int)$this->request->get('page_size', 15);
|
||||||
$params = $this->request->get();
|
$params = $this->request->get();
|
||||||
@ -81,7 +81,6 @@ class UserController extends BaseAdminController
|
|||||||
$res['page_no'] = $params['page_no'];
|
$res['page_no'] = $params['page_no'];
|
||||||
$res['page_size'] = $params['page_size'];
|
$res['page_size'] = $params['page_size'];
|
||||||
return $this->success('ok', $res);
|
return $this->success('ok', $res);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -91,7 +90,6 @@ class UserController extends BaseAdminController
|
|||||||
public function userSing()
|
public function userSing()
|
||||||
{
|
{
|
||||||
return $this->dataLists(new UserSignLogLists());
|
return $this->dataLists(new UserSignLogLists());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -107,10 +105,24 @@ class UserController extends BaseAdminController
|
|||||||
$params['page_no'] = $page_no > 0 ? $page_no : 1;
|
$params['page_no'] = $page_no > 0 ? $page_no : 1;
|
||||||
$params['page_size'] = $page_size > 0 ? $page_size : 15;
|
$params['page_size'] = $page_size > 0 ? $page_size : 15;
|
||||||
$uid = $uid['id'];
|
$uid = $uid['id'];
|
||||||
$res = UserLogic::giftList($uid,$params);
|
$res = UserLogic::giftList($uid, $params);
|
||||||
$res['page_no'] = $params['page_no'];
|
$res['page_no'] = $params['page_no'];
|
||||||
$res['page_size'] = $params['page_size'];
|
$res['page_size'] = $params['page_size'];
|
||||||
return $this->success('ok', $res);
|
return $this->success('ok', $res);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
//设置采购款
|
||||||
|
public function setPurchaseFunds()
|
||||||
|
{
|
||||||
|
$params = $this->request->post();
|
||||||
|
$res = UserLogic::PurchaseFunds($params);
|
||||||
|
return $this->success( '设置成功',[],1,1);
|
||||||
|
}
|
||||||
|
//设置余额
|
||||||
|
public function setnowMoney()
|
||||||
|
{
|
||||||
|
$params = $this->request->post();
|
||||||
|
$res = UserLogic::nowMoney($params);
|
||||||
|
return $this->success( '设置成功',[],1,1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -71,7 +71,7 @@ class BeforehandOrderCartInfoLists extends BaseAdminDataLists implements ListsSe
|
|||||||
}
|
}
|
||||||
|
|
||||||
$list = BeforehandOrderCartInfo::where($this->searchWhere)
|
$list = BeforehandOrderCartInfo::where($this->searchWhere)
|
||||||
->field(['id', 'bhoid', 'uid', 'is_buyer', 'buyer_uid', 'product_id', 'attr_value_id', 'purchase', 'price', 'total_price', 'cart_num', 'mark'])
|
->field(['id', 'bhoid','package','store_info','marques','gross_weight','net_weight','accept_num','after_sales','loss', 'uid', 'is_buyer', 'buyer_uid', 'product_id', 'attr_value_id', 'purchase', 'price', 'total_price', 'cart_num', 'mark'])
|
||||||
->limit($this->limitOffset, $this->limitLength)
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
->order(['id' => 'desc'])
|
->order(['id' => 'desc'])
|
||||||
->select()->each(function ($item) use($system_store,$order_mark) {
|
->select()->each(function ($item) use($system_store,$order_mark) {
|
||||||
@ -140,12 +140,18 @@ class BeforehandOrderCartInfoLists extends BaseAdminDataLists implements ListsSe
|
|||||||
'bhoid' => '订单id',
|
'bhoid' => '订单id',
|
||||||
'store_name' => '商品名称',
|
'store_name' => '商品名称',
|
||||||
'system_store' => '门店',
|
'system_store' => '门店',
|
||||||
'warehouse_stock' => '仓库数量',
|
'marques' => '型号',
|
||||||
'cart_num' => '需求数量',
|
'package' => '包装',
|
||||||
'top_cate_name' => '分类',
|
'top_cate_name' => '分类',
|
||||||
'unit_name' => '单位',
|
'unit_name' => '单位',
|
||||||
|
'gross_weight' => '毛重',
|
||||||
|
'net_weight' => '净重',
|
||||||
|
'warehouse_stock' => '仓库数量',
|
||||||
|
'cart_num' => '需求数量',
|
||||||
'price' => '单价',
|
'price' => '单价',
|
||||||
'total_price' => '总价',
|
'total_price' => '总价',
|
||||||
|
'after_sales' => '售后',
|
||||||
|
'loss' => '损耗',
|
||||||
'mark' => '备注',
|
'mark' => '备注',
|
||||||
'order_mark' => '订单备注',
|
'order_mark' => '订单备注',
|
||||||
|
|
||||||
|
@ -66,6 +66,8 @@ class StoreExtractLists extends BaseAdminDataLists implements ListsSearchInterfa
|
|||||||
$item->id_card=$find['id_card'];
|
$item->id_card=$find['id_card'];
|
||||||
$item->openid=$openid;
|
$item->openid=$openid;
|
||||||
}
|
}
|
||||||
|
$item->status_name=$item->status==1?"通过":"审核中";
|
||||||
|
$item->pay_status_name=$item->pay_status==1?"已转账":"未转账";
|
||||||
})
|
})
|
||||||
->toArray();
|
->toArray();
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ class StoreFinanceFlowLists extends BaseAdminDataLists implements ListsSearchInt
|
|||||||
public function setSearch(): array
|
public function setSearch(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'=' => ['store_id', 'user_id', 'create_time', 'staff_id','financial_type','financial_pm','order_id'],
|
'=' => ['store_id', 'user_id', 'create_time', 'staff_id','financial_type','financial_pm','order_id','order_sn'],
|
||||||
'between_time' => 'create_time',
|
'between_time' => 'create_time',
|
||||||
'%pipe_like%' => ['keyword' => 'order_sn'],
|
'%pipe_like%' => ['keyword' => 'order_sn'],
|
||||||
];
|
];
|
||||||
|
@ -11,6 +11,8 @@ use app\common\model\store_product\StoreProduct;
|
|||||||
use app\common\model\system_store\SystemStore;
|
use app\common\model\system_store\SystemStore;
|
||||||
use app\common\model\warehouse\Warehouse;
|
use app\common\model\warehouse\Warehouse;
|
||||||
use app\common\lists\ListsExcelInterface;
|
use app\common\lists\ListsExcelInterface;
|
||||||
|
use app\common\model\store_category\StoreCategory;
|
||||||
|
use app\common\model\store_product_unit\StoreProductUnit;
|
||||||
use app\common\model\supplier\Supplier;
|
use app\common\model\supplier\Supplier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -78,6 +80,9 @@ class WarehouseProductLists extends BaseAdminDataLists implements ListsSearchInt
|
|||||||
$item->store_name = '';
|
$item->store_name = '';
|
||||||
$item->image = '';
|
$item->image = '';
|
||||||
$item->price = '';
|
$item->price = '';
|
||||||
|
$item->unit_name = '';
|
||||||
|
$item->store_info = '';
|
||||||
|
$item->top_cate_name = '';
|
||||||
if ($item->financial_pm == 0) {
|
if ($item->financial_pm == 0) {
|
||||||
$item->financial_pm_name = '出库';
|
$item->financial_pm_name = '出库';
|
||||||
} else {
|
} else {
|
||||||
@ -101,11 +106,14 @@ class WarehouseProductLists extends BaseAdminDataLists implements ListsSearchInt
|
|||||||
$item->admin_name = '';
|
$item->admin_name = '';
|
||||||
}
|
}
|
||||||
if ($item->product_id) {
|
if ($item->product_id) {
|
||||||
$find = StoreProduct::where('id', $item->product_id)->field('price,image,store_name')->find();
|
$find = StoreProduct::where('id', $item->product_id)->field('price,image,store_name,unit,store_info,top_cate_id')->withTrashed()->find();
|
||||||
if($find){
|
if($find){
|
||||||
$item->store_name = $find->store_name . '|' . $item->product_id;
|
$item->store_name = $find->store_name . '|' . $item->product_id;
|
||||||
$item->image = $find->image;
|
$item->image = $find->image;
|
||||||
$item->price = $find->price;
|
$item->price = $find->price;
|
||||||
|
$item->unit_name = StoreProductUnit::where('id', $find->unit)->value('name');
|
||||||
|
$item->store_info =$find->store_info;
|
||||||
|
$item->top_cate_name =StoreCategory::where('id', $find->top_cate_id)->value('name');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($item->warehouse_id) {
|
if ($item->warehouse_id) {
|
||||||
@ -182,12 +190,18 @@ class WarehouseProductLists extends BaseAdminDataLists implements ListsSearchInt
|
|||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
$data = [
|
$data = [
|
||||||
|
'id' => 'id',
|
||||||
'admin_name' => '操作人员',
|
'admin_name' => '操作人员',
|
||||||
'warehouse_name' => '仓库',
|
'warehouse_name' => '仓库',
|
||||||
'store_name' => '商品名称',
|
'store_name' => '商品名称',
|
||||||
|
'top_cate_name' => '分类',
|
||||||
|
'store_info' => '规格',
|
||||||
|
'unit_name' => '单位',
|
||||||
'financial_pm_name' => '出入库',
|
'financial_pm_name' => '出入库',
|
||||||
'system_store_name' => '门店',
|
'system_store_name' => '门店',
|
||||||
'nums' => '数量',
|
'nums' => '数量',
|
||||||
|
'purchase' => '价格',
|
||||||
|
'total_price' => '总价',
|
||||||
'create_time' => '操作时间',
|
'create_time' => '操作时间',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -55,11 +55,24 @@ class BeforehandOrderLogic extends BaseLogic
|
|||||||
$total_price = 0;
|
$total_price = 0;
|
||||||
$uid = $params['uid'] ?? 0;
|
$uid = $params['uid'] ?? 0;
|
||||||
foreach ($params['product_arr'] as $k => $v) {
|
foreach ($params['product_arr'] as $k => $v) {
|
||||||
|
if($v['product_id']<=0){
|
||||||
|
unset($params['product_arr'][$k]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$datas[$k]['purchase'] = $v['purchase'];
|
||||||
$datas[$k]['mark'] = $v['mark'] ?? '';
|
$datas[$k]['mark'] = $v['mark'] ?? '';
|
||||||
$datas[$k]['product_id'] = $v['product_id'];
|
$datas[$k]['product_id'] = $v['product_id'];
|
||||||
$datas[$k]['uid'] = $uid;
|
$datas[$k]['uid'] = $uid;
|
||||||
|
$datas[$k]['marques'] = $v['marques'];
|
||||||
|
$datas[$k]['store_info'] = $v['store_info'];
|
||||||
|
$datas[$k]['after_sales'] = $v['after_sales'];
|
||||||
|
$datas[$k]['loss'] = $v['loss'];
|
||||||
|
$datas[$k]['unit'] = $v['unit'];
|
||||||
|
$datas[$k]['gross_weight'] = $v['gross_weight'];
|
||||||
|
$datas[$k]['net_weight'] = $v['net_weight'];
|
||||||
$datas[$k]['cart_num'] = $v['nums'];
|
$datas[$k]['cart_num'] = $v['nums'];
|
||||||
$datas[$k]['price'] = $v['purchase'];
|
$datas[$k]['price'] = $v['price'];
|
||||||
|
$datas[$k]['package'] = $v['package'];
|
||||||
$datas[$k]['total_price'] = $v['total_price'];
|
$datas[$k]['total_price'] = $v['total_price'];
|
||||||
$datas[$k]['create_time'] = time();
|
$datas[$k]['create_time'] = time();
|
||||||
$datas[$k]['update_time'] = time();
|
$datas[$k]['update_time'] = time();
|
||||||
@ -84,9 +97,22 @@ class BeforehandOrderLogic extends BaseLogic
|
|||||||
'arrival_time' => strtotime($params['arrival_time']),
|
'arrival_time' => strtotime($params['arrival_time']),
|
||||||
'order_type' => $order_type
|
'order_type' => $order_type
|
||||||
]);
|
]);
|
||||||
|
$product_arr=[];
|
||||||
foreach ($datas as $k => $v) {
|
foreach ($datas as $k => $v) {
|
||||||
$datas[$k]['bhoid'] = $order['id'];
|
$datas[$k]['bhoid'] = $order['id'];
|
||||||
|
|
||||||
|
$data['id']=$v['product_id'];
|
||||||
|
$data['marques']=$v['marques'];
|
||||||
|
$data['store_info']=$v['store_info'];
|
||||||
|
$data['after_sales']=$v['after_sales'];
|
||||||
|
$data['package']=$v['package'];
|
||||||
|
$data['loss']=$v['loss'];
|
||||||
|
$data['gross_weight']=$v['gross_weight'];
|
||||||
|
$data['net_weight']=$v['net_weight'];
|
||||||
|
$data['mark']=$v['mark'];
|
||||||
|
$product_arr[]=$data;
|
||||||
}
|
}
|
||||||
|
(new StoreProduct())->saveAll($product_arr);
|
||||||
(new BeforehandOrderCartInfo())->saveAll($datas);
|
(new BeforehandOrderCartInfo())->saveAll($datas);
|
||||||
Db::commit();
|
Db::commit();
|
||||||
return true;
|
return true;
|
||||||
@ -335,7 +361,7 @@ class BeforehandOrderLogic extends BaseLogic
|
|||||||
'admin_id' => $admin_id,
|
'admin_id' => $admin_id,
|
||||||
'total_price' => $arr['total_price'],
|
'total_price' => $arr['total_price'],
|
||||||
'price' => $arr['price'],
|
'price' => $arr['price'],
|
||||||
'purchase' => $arr['price'],
|
'purchase' => $arr['purchase'],
|
||||||
'oid' => $res['id'],
|
'oid' => $res['id'],
|
||||||
'code' => $res['code'],
|
'code' => $res['code'],
|
||||||
];
|
];
|
||||||
|
@ -40,6 +40,25 @@ class StoreExtractLogic extends BaseLogic
|
|||||||
throw new BusinessException($e->getMessage());
|
throw new BusinessException($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @notes 确认提现
|
||||||
|
* @param array $params
|
||||||
|
* @return bool
|
||||||
|
* @author admin
|
||||||
|
* @date 2024/05/31 17:09
|
||||||
|
*/
|
||||||
|
public static function Enter(array $params): bool
|
||||||
|
{
|
||||||
|
Db::startTrans();
|
||||||
|
try {
|
||||||
|
StoreExtract::update(['status'=>1,'pay_status'=>1],['id'=>$params['id']]);
|
||||||
|
Db::commit();
|
||||||
|
return true;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Db::rollback();
|
||||||
|
throw new BusinessException($e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,6 +11,7 @@ use app\common\model\store_branch_product_exchange\StoreBranchProductExchange;
|
|||||||
use app\common\model\store_category\StoreCategory;
|
use app\common\model\store_category\StoreCategory;
|
||||||
use app\common\model\store_product_attr_value\StoreProductAttrValue;
|
use app\common\model\store_product_attr_value\StoreProductAttrValue;
|
||||||
use app\common\model\store_product_cate\StoreProductCate;
|
use app\common\model\store_product_cate\StoreProductCate;
|
||||||
|
use app\common\model\store_product_unit\StoreProductUnit;
|
||||||
use app\common\model\system_store\SystemStore;
|
use app\common\model\system_store\SystemStore;
|
||||||
use app\common\model\system_store_storage\SystemStoreStorage;
|
use app\common\model\system_store_storage\SystemStoreStorage;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
@ -288,18 +289,10 @@ class StoreProductLogic extends BaseLogic
|
|||||||
public static function detail($params): array
|
public static function detail($params): array
|
||||||
{
|
{
|
||||||
$data = StoreProduct::where('id', $params['id'])->findOrEmpty()->toArray();
|
$data = StoreProduct::where('id', $params['id'])->findOrEmpty()->toArray();
|
||||||
if ($data) {
|
if(empty($data)){
|
||||||
$data['cate_arr'] = [];
|
throw new BusinessException('商品不存在');
|
||||||
$id_1 = StoreCategory::where('id', $data['cate_id'])->value('pid');
|
|
||||||
if ($id_1) {
|
|
||||||
$id_2 = StoreCategory::where('id', $id_1)->value('pid');
|
|
||||||
if ($id_2 == 0) {
|
|
||||||
$data['cate_arr'] = [$id_1, $data['cate_id']];
|
|
||||||
} else {
|
|
||||||
$data['cate_arr'] = [$id_2, $id_1, $data['cate_id']];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
$data['unit_name']=StoreProductUnit::where('id', $data['unit'])->value('name');
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ use app\common\enum\OrderEnum;
|
|||||||
use app\common\enum\user\UserTerminalEnum;
|
use app\common\enum\user\UserTerminalEnum;
|
||||||
use app\common\enum\YesNoEnum;
|
use app\common\enum\YesNoEnum;
|
||||||
use app\common\logic\BaseLogic;
|
use app\common\logic\BaseLogic;
|
||||||
|
use app\common\logic\CapitalFlowLogic;
|
||||||
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;
|
||||||
@ -57,7 +58,7 @@ class UserLogic extends BaseLogic
|
|||||||
|
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
$res=User::create([
|
$res = User::create([
|
||||||
'avatar' => $avatar,
|
'avatar' => $avatar,
|
||||||
'real_name' => $params['real_name'],
|
'real_name' => $params['real_name'],
|
||||||
'nickname' => $params['nickname'],
|
'nickname' => $params['nickname'],
|
||||||
@ -78,21 +79,21 @@ class UserLogic extends BaseLogic
|
|||||||
|
|
||||||
public static function checkAddress(array $params)
|
public static function checkAddress(array $params)
|
||||||
{
|
{
|
||||||
$user_ship=$params['user_ship']??0;
|
$user_ship = $params['user_ship'] ?? 0;
|
||||||
if($user_ship==2){
|
if ($user_ship == 2) {
|
||||||
if(!isset($params['village'])){
|
if (!isset($params['village'])) {
|
||||||
throw new BusinessException('请设置村参数');
|
throw new BusinessException('请设置村参数');
|
||||||
}
|
}
|
||||||
$arr=User::where('user_ship',$user_ship)->alias('user')->join('user_address address','user.id=address.uid and village='.$params['village'])->find();
|
$arr = User::where('user_ship', $user_ship)->alias('user')->join('user_address address', 'user.id=address.uid and village=' . $params['village'])->find();
|
||||||
if ($arr) {
|
if ($arr) {
|
||||||
throw new BusinessException('该区域已有村长请重新选择');
|
throw new BusinessException('该区域已有村长请重新选择');
|
||||||
}
|
}
|
||||||
}elseif($user_ship==3){
|
} elseif ($user_ship == 3) {
|
||||||
if(!isset($params['brigade'])){
|
if (!isset($params['brigade'])) {
|
||||||
throw new BusinessException('请设置队参数');
|
throw new BusinessException('请设置队参数');
|
||||||
}
|
}
|
||||||
$arr=User::where('user_ship',$user_ship)->alias('user')->join('user_address address','user.id=address.uid and village='.$params['village'] .' and brigade='.$params['brigade'])->find();
|
$arr = User::where('user_ship', $user_ship)->alias('user')->join('user_address address', 'user.id=address.uid and village=' . $params['village'] . ' and brigade=' . $params['brigade'])->find();
|
||||||
if($arr){
|
if ($arr) {
|
||||||
throw new BusinessException('该区域已有队长请重新选择');
|
throw new BusinessException('该区域已有队长请重新选择');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -107,37 +108,37 @@ class UserLogic extends BaseLogic
|
|||||||
$avatar = !empty($params['avatar']) ? FileService::setFileUrl($params['avatar']) : $defaultAvatar;
|
$avatar = !empty($params['avatar']) ? FileService::setFileUrl($params['avatar']) : $defaultAvatar;
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
$data=[
|
$data = [
|
||||||
'avatar' => $avatar,
|
'avatar' => $avatar,
|
||||||
'real_name' => $params['real_name']??"",
|
'real_name' => $params['real_name'] ?? "",
|
||||||
'nickname' => '用户'.time(),
|
'nickname' => '用户' . time(),
|
||||||
'account' => $params['mobile'],
|
'account' => $params['mobile'],
|
||||||
'password' => $password,
|
'password' => $password,
|
||||||
'mobile' => $params['mobile'],
|
'mobile' => $params['mobile'],
|
||||||
'label_id' => $params['label_id']??0,
|
'label_id' => $params['label_id'] ?? 0,
|
||||||
'store_id' => $params['store_id']??0,
|
'store_id' => $params['store_id'] ?? 0,
|
||||||
];
|
];
|
||||||
if(isset($params['user_ship']) &&$params['user_ship']==4){
|
if (isset($params['user_ship']) && $params['user_ship'] == 4) {
|
||||||
$data['user_ship']=4;
|
$data['user_ship'] = 4;
|
||||||
}
|
}
|
||||||
$res=User::create($data);
|
$res = User::create($data);
|
||||||
UserCreateLog::create([
|
UserCreateLog::create([
|
||||||
'uid' => $res['id'],
|
'uid' => $res['id'],
|
||||||
'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,
|
'user_ship' => $data['user_ship'] ?? 0,
|
||||||
]);
|
]);
|
||||||
UserAddress::create([
|
UserAddress::create([
|
||||||
'uid' => $res['id'],
|
'uid' => $res['id'],
|
||||||
'real_name' => $params['real_name']??"",
|
'real_name' => $params['real_name'] ?? "",
|
||||||
'mobile' => $params['mobile']??'',
|
'mobile' => $params['mobile'] ?? '',
|
||||||
'province' => $params['province']??'',
|
'province' => $params['province'] ?? '',
|
||||||
'city' => $params['city']??'',
|
'city' => $params['city'] ?? '',
|
||||||
'area' => $params['area']??'',
|
'area' => $params['area'] ?? '',
|
||||||
'street' => $params['street']??'',
|
'street' => $params['street'] ?? '',
|
||||||
'village' => $params['village']??'',
|
'village' => $params['village'] ?? '',
|
||||||
'brigade' => $params['brigade']??'',
|
'brigade' => $params['brigade'] ?? '',
|
||||||
'is_default' => 1,
|
'is_default' => 1,
|
||||||
]);
|
]);
|
||||||
Db::commit();
|
Db::commit();
|
||||||
@ -167,7 +168,7 @@ class UserLogic extends BaseLogic
|
|||||||
// 'mobile' => $params['mobile'] ?? '',
|
// 'mobile' => $params['mobile'] ?? '',
|
||||||
// 'sex' => $params['sex'] ?? 0,
|
// 'sex' => $params['sex'] ?? 0,
|
||||||
// 'is_disable' => $params['is_disable'] ?? 0,
|
// 'is_disable' => $params['is_disable'] ?? 0,
|
||||||
'label_id'=>$params['label_id']
|
'label_id' => $params['label_id']
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Db::commit();
|
Db::commit();
|
||||||
@ -188,8 +189,21 @@ class UserLogic extends BaseLogic
|
|||||||
public static function detail(int $userId): array
|
public static function detail(int $userId): array
|
||||||
{
|
{
|
||||||
$field = [
|
$field = [
|
||||||
'id', 'account', 'nickname', 'avatar', 'real_name','integral','label_id','user_ship',
|
'id',
|
||||||
'sex', 'mobile', 'create_time', 'login_time', 'channel','now_money','purchase_funds'
|
'account',
|
||||||
|
'nickname',
|
||||||
|
'avatar',
|
||||||
|
'real_name',
|
||||||
|
'integral',
|
||||||
|
'label_id',
|
||||||
|
'user_ship',
|
||||||
|
'sex',
|
||||||
|
'mobile',
|
||||||
|
'create_time',
|
||||||
|
'login_time',
|
||||||
|
'channel',
|
||||||
|
'now_money',
|
||||||
|
'purchase_funds'
|
||||||
];
|
];
|
||||||
|
|
||||||
$user = User::where(['id' => $userId])->field($field)
|
$user = User::where(['id' => $userId])->field($field)
|
||||||
@ -197,8 +211,8 @@ class UserLogic extends BaseLogic
|
|||||||
|
|
||||||
$user['channel'] = UserTerminalEnum::getTermInalDesc($user['channel']);
|
$user['channel'] = UserTerminalEnum::getTermInalDesc($user['channel']);
|
||||||
$user->sex = $user->getData('sex');
|
$user->sex = $user->getData('sex');
|
||||||
$user['number']=StoreFinanceFlow::where('other_uid',$userId)->where(['status'=>0,'financial_pm'=>1,'type'=>1])->sum('number');
|
$user['number'] = StoreFinanceFlow::where('other_uid', $userId)->where(['status' => 0, 'financial_pm' => 1, 'type' => 1])->sum('number');
|
||||||
$user['user_ship_name']=$user->user_ship>0?UserShip::where('id',$user->user_ship)->value('title'):"一般用户";
|
$user['user_ship_name'] = $user->user_ship > 0 ? UserShip::where('id', $user->user_ship)->value('title') : "一般用户";
|
||||||
return $user->toArray();
|
return $user->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,66 +232,116 @@ class UserLogic extends BaseLogic
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新采购款
|
||||||
|
*/
|
||||||
|
public static function PurchaseFunds(array $params)
|
||||||
|
{
|
||||||
|
$find = User::where(['id' => $params['id']])->find();
|
||||||
|
Db::startTrans();
|
||||||
|
try {
|
||||||
|
$capitalFlowDao = new CapitalFlowLogic($find, 'user');
|
||||||
|
if ($params['type'] == 1) {
|
||||||
|
$capitalFlowDao->userIncome('system_purchase_add', 'system', 0, $params['purchase_funds'],'',1);
|
||||||
|
$find->purchase_funds = bcadd($params['purchase_funds'], $find['purchase_funds'], 2);
|
||||||
|
$find->save();
|
||||||
|
} else {
|
||||||
|
$capitalFlowDao->userExpense('system_purchase_dec', 'system', 0, $params['purchase_funds']);
|
||||||
|
$find->purchase_funds = bcsub($params['purchase_funds'], $find['purchase_funds'], 2);
|
||||||
|
$find->save();
|
||||||
|
}
|
||||||
|
Db::commit();
|
||||||
|
return true;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Db::rollback();
|
||||||
|
throw new BusinessException($e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 更新余额
|
||||||
|
*/
|
||||||
|
public static function nowMoney(array $params)
|
||||||
|
{
|
||||||
|
$find = User::where(['id' => $params['id']])->find();
|
||||||
|
Db::startTrans();
|
||||||
|
try {
|
||||||
|
$capitalFlowDao = new CapitalFlowLogic($find, 'user');
|
||||||
|
if ($params['type'] == 1) {
|
||||||
|
$capitalFlowDao->userIncome('system_balance_add', 'system', 0, $params['now_money'],);
|
||||||
|
$find->now_money = bcadd($params['now_money'], $find['now_money'], 2);
|
||||||
|
$find->save();
|
||||||
|
} else {
|
||||||
|
$capitalFlowDao->userExpense('system_balance_reduce', 'system', 0, $params['now_money']);
|
||||||
|
$find->now_money = bcsub($params['now_money'], $find['now_money'], 2);
|
||||||
|
$find->save();
|
||||||
|
}
|
||||||
|
Db::commit();
|
||||||
|
return true;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Db::rollback();
|
||||||
|
throw new BusinessException($e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
public static function dealDetails($params)
|
public static function dealDetails($params)
|
||||||
{
|
{
|
||||||
switch ($params['type']){
|
switch ($params['type']) {
|
||||||
case 1:
|
case 1:
|
||||||
//采购款明细
|
//采购款明细
|
||||||
$categories = ['user_balance_recharge', 'user_order_purchase_pay','system_purchase_add','user_balance_recharge_refund'];
|
$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();
|
||||||
$data = $query
|
$data = $query
|
||||||
->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){
|
foreach ($data as &$value) {
|
||||||
if($value['category'] == 'user_order_purchase_pay'){
|
if ($value['category'] == 'user_order_purchase_pay') {
|
||||||
$value['order_sn'] = StoreOrder::where('id',$value['link_id'])->value('order_id');
|
$value['order_sn'] = StoreOrder::where('id', $value['link_id'])->value('order_id');
|
||||||
}elseif($value['category'] == 'user_balance_recharge'){
|
} elseif ($value['category'] == 'user_balance_recharge') {
|
||||||
$value['order_sn'] = UserRecharge::where('id',$value['link_id'])->value('order_id');
|
$value['order_sn'] = UserRecharge::where('id', $value['link_id'])->value('order_id');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
//余额明细
|
//余额明细
|
||||||
$category = ['system_balance_add','user_order_balance_pay'];
|
$category = ['system_balance_add', 'user_order_balance_pay'];
|
||||||
$query = CapitalFlow::where('uid', $params['id'])
|
$query = CapitalFlow::where('uid', $params['id'])
|
||||||
->whereIn('category', $category);
|
->whereIn('category', $category);
|
||||||
$count = $query->count();
|
$count = $query->count();
|
||||||
$data = $query
|
$data = $query
|
||||||
->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){
|
foreach ($data as &$value) {
|
||||||
$value['order_sn'] = StoreOrder::where('id',$value['link_id'])->value('order_id');
|
$value['order_sn'] = StoreOrder::where('id', $value['link_id'])->value('order_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
//礼品券明细
|
//礼品券明细
|
||||||
$query = UserSign::where(['uid'=>$params['id']]);
|
$query = UserSign::where(['uid' => $params['id']]);
|
||||||
$count = $query->count();
|
$count = $query->count();
|
||||||
$data =$query
|
$data = $query
|
||||||
->page($params['page_no'],$params['page_size'])
|
->page($params['page_no'], $params['page_size'])
|
||||||
->order('id','desc')
|
->order('id', 'desc')
|
||||||
->select()->toArray();
|
->select()->toArray();
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
//返还金明细 -todo back
|
//返还金明细 -todo back
|
||||||
$query = VipFlow::with('store')->where(['user_id'=>$params['id']]);
|
$query = VipFlow::with('store')->where(['user_id' => $params['id']]);
|
||||||
$count = $query->count();
|
$count = $query->count();
|
||||||
$data = $query
|
$data = $query
|
||||||
->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){
|
foreach ($data as &$value) {
|
||||||
if($value['status'] == 0){
|
if ($value['status'] == 0) {
|
||||||
$value['title'] = "购买商品".$value['all']."元获得".$value['number']."元返还金";
|
$value['title'] = "购买商品" . $value['all'] . "元获得" . $value['number'] . "元返还金";
|
||||||
}else{
|
} else {
|
||||||
//退回到余额、微信、采购款
|
//退回到余额、微信、采购款
|
||||||
$back = self::dealTitleCate($value['pay_type']);
|
$back = self::dealTitleCate($value['pay_type']);
|
||||||
$value['title'] = "返还金解冻".$value['number']."元退回到".$back;
|
$value['title'] = "返还金解冻" . $value['number'] . "元退回到" . $back;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -289,27 +353,24 @@ class UserLogic extends BaseLogic
|
|||||||
'lists' => $data,
|
'lists' => $data,
|
||||||
'count' => $count
|
'count' => $count
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function giftList($uid,$params)
|
public static function giftList($uid, $params)
|
||||||
{
|
{
|
||||||
$query = StoreProductGift::with(['store','user','goodsName'])->where('uid',$uid);
|
$query = StoreProductGift::with(['store', 'user', 'goodsName'])->where('uid', $uid);
|
||||||
$count = $query->count();
|
$count = $query->count();
|
||||||
$list = $query->page($params['page_no'],$params['page_size'])
|
$list = $query->page($params['page_no'], $params['page_size'])
|
||||||
->order('id','desc')
|
->order('id', 'desc')
|
||||||
->select()->toArray();
|
->select()->toArray();
|
||||||
return [
|
return [
|
||||||
'lists' => $list,
|
'lists' => $list,
|
||||||
'count' => $count
|
'count' => $count
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function dealTitleCate($pay_type)
|
public static function dealTitleCate($pay_type)
|
||||||
{
|
{
|
||||||
switch ($pay_type){
|
switch ($pay_type) {
|
||||||
case 18:
|
case 18:
|
||||||
$title = "采购款";
|
$title = "采购款";
|
||||||
break;
|
break;
|
||||||
@ -317,17 +378,17 @@ class UserLogic extends BaseLogic
|
|||||||
$title = "现金";
|
$title = "现金";
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
$title ="余额";
|
$title = "余额";
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
case 9:
|
case 9:
|
||||||
$title ="微信";
|
$title = "微信";
|
||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
$title ="支付宝";
|
$title = "支付宝";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$title ="默认";
|
$title = "默认";
|
||||||
}
|
}
|
||||||
return $title;
|
return $title;
|
||||||
}
|
}
|
||||||
|
@ -154,8 +154,9 @@ class WarehouseProductLogic extends BaseLogic
|
|||||||
'nums' => $params['nums'],
|
'nums' => $params['nums'],
|
||||||
'before_nums' => $storege['nums'],
|
'before_nums' => $storege['nums'],
|
||||||
'after_nums' => $after_nums,
|
'after_nums' => $after_nums,
|
||||||
'purchase' => $params['purchase'] ?? '',
|
'price' => $params['price'] ?? 0,
|
||||||
'total_price' => $params['total_price'] ?? '',
|
'purchase' => $params['purchase'] ?? 0,
|
||||||
|
'total_price' => $params['total_price'] ?? 0,
|
||||||
'admin_id' => $params['admin_id'],
|
'admin_id' => $params['admin_id'],
|
||||||
'code' => $params['code'] ?? '',
|
'code' => $params['code'] ?? '',
|
||||||
'status' => 1,
|
'status' => 1,
|
||||||
|
@ -80,8 +80,8 @@ class CapitalFlowLogic extends BaseLogic
|
|||||||
$model->before_balance = bcadd($this->user['now_money'], $amount, 2);
|
$model->before_balance = bcadd($this->user['now_money'], $amount, 2);
|
||||||
$model->balance = $this->user['now_money'];
|
$model->balance = $this->user['now_money'];
|
||||||
} else {
|
} else {
|
||||||
$model->before_balance = $this->user['now_money'];
|
$model->before_balance = $this->user['purchase_funds'];
|
||||||
$model->balance = $this->user['now_money'];
|
$model->balance = bcsub($this->user['purchase_funds'], $amount, 2);
|
||||||
}
|
}
|
||||||
$model->create_time = date('Y-m-d H:i:s');
|
$model->create_time = date('Y-m-d H:i:s');
|
||||||
$model->type = 'out';
|
$model->type = 'out';
|
||||||
@ -176,6 +176,8 @@ class CapitalFlowLogic extends BaseLogic
|
|||||||
return "系统增加余额{$amount}元";
|
return "系统增加余额{$amount}元";
|
||||||
case 'system_purchase_add':
|
case 'system_purchase_add':
|
||||||
return "系统增加采购款{$amount}元";
|
return "系统增加采购款{$amount}元";
|
||||||
|
case 'system_purchase_dec':
|
||||||
|
return "系统减少采购款{$amount}元";
|
||||||
case 'system_balance_reduce':
|
case 'system_balance_reduce':
|
||||||
return "系统减少余额{$amount}元";
|
return "系统减少余额{$amount}元";
|
||||||
case 'user_balance_recharge_refund':
|
case 'user_balance_recharge_refund':
|
||||||
|
@ -6,4 +6,6 @@ namespace app\common\model;
|
|||||||
|
|
||||||
class OperationLog extends BaseModel
|
class OperationLog extends BaseModel
|
||||||
{
|
{
|
||||||
|
// protected $json = ['params'];
|
||||||
|
|
||||||
}
|
}
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user