Merge pull request 'feat(beforehand_order): 添加订单其他数据字段并优化用户资金流操作' (#299) from dev into main
Reviewed-on: #299
This commit is contained in:
commit
33cbd1a6dd
@ -57,6 +57,18 @@ class BeforehandOrderController extends BaseAdminController
|
|||||||
{
|
{
|
||||||
$params = $this->request->post();
|
$params = $this->request->post();
|
||||||
$params['admin_id'] = $this->adminId;
|
$params['admin_id'] = $this->adminId;
|
||||||
|
$other_data=[
|
||||||
|
'nickname'=>$params['nickname']??'',
|
||||||
|
'phone'=>$params['phone']??'',
|
||||||
|
'address'=>$params['address']??'',
|
||||||
|
'arrival_time'=>$params['arrival_time']??'',
|
||||||
|
'purpose'=>$params['purpose']??'',
|
||||||
|
'tables'=>$params['tables']??'',
|
||||||
|
'days'=>$params['days']??'',
|
||||||
|
'chef'=>$params['chef']??'',
|
||||||
|
'chef_phone'=>$params['chef_phone']??'',
|
||||||
|
];
|
||||||
|
$params['other_data'] = $other_data;
|
||||||
$result = BeforehandOrderLogic::add($params);
|
$result = BeforehandOrderLogic::add($params);
|
||||||
return $this->success('添加成功', [], 1, 1);
|
return $this->success('添加成功', [], 1, 1);
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte
|
|||||||
public function setSearch(): array
|
public function setSearch(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'=' => ['store_id', 'order_id', 'uid','paid','status','order_type','order_sn'],
|
'=' => ['store_id', 'order_id', 'paid','status','order_type','order_sn'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte
|
|||||||
public function lists(): array
|
public function lists(): array
|
||||||
{
|
{
|
||||||
return BeforehandOrder::where($this->searchWhere)
|
return BeforehandOrder::where($this->searchWhere)
|
||||||
->field(['id','order_id','store_id','uid','order_type','total_num','total_price','outbound_id','admin_id','create_time', 'status', 'mark','warehousing_id'])
|
->field(['id','order_id','store_id','order_type','total_num','total_price','outbound_id','admin_id','create_time', 'status', 'mark','warehousing_id'])
|
||||||
->limit($this->limitOffset, $this->limitLength)
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
->order(['id' => 'desc'])
|
->order(['id' => 'desc'])
|
||||||
->select()->each(function ($item){
|
->select()->each(function ($item){
|
||||||
|
@ -95,7 +95,8 @@ class BeforehandOrderLogic extends BaseLogic
|
|||||||
'address' => $params['address'] ?? '',
|
'address' => $params['address'] ?? '',
|
||||||
'mark' => $params['mark'] ?? '',
|
'mark' => $params['mark'] ?? '',
|
||||||
'arrival_time' => strtotime($params['arrival_time']),
|
'arrival_time' => strtotime($params['arrival_time']),
|
||||||
'order_type' => $order_type
|
'order_type' => $order_type,
|
||||||
|
'other_data' => json_encode($params['other_data'],true)
|
||||||
]);
|
]);
|
||||||
$product_arr=[];
|
$product_arr=[];
|
||||||
foreach ($datas as $k => $v) {
|
foreach ($datas as $k => $v) {
|
||||||
|
@ -242,11 +242,11 @@ class UserLogic extends BaseLogic
|
|||||||
try {
|
try {
|
||||||
$capitalFlowDao = new CapitalFlowLogic($find, 'user');
|
$capitalFlowDao = new CapitalFlowLogic($find, 'user');
|
||||||
if ($params['type'] == 1) {
|
if ($params['type'] == 1) {
|
||||||
$capitalFlowDao->userIncome('system_purchase_add', 'system', 0, $params['purchase_funds'],'',1);
|
$capitalFlowDao->userIncome('system_purchase_add', 'system', 0, $params['purchase_funds'],$params['mark']??'',1);
|
||||||
$find->purchase_funds = bcadd($params['purchase_funds'], $find['purchase_funds'], 2);
|
$find->purchase_funds = bcadd($params['purchase_funds'], $find['purchase_funds'], 2);
|
||||||
$find->save();
|
$find->save();
|
||||||
} else {
|
} else {
|
||||||
$capitalFlowDao->userExpense('system_purchase_dec', 'system', 0, $params['purchase_funds']);
|
$capitalFlowDao->userExpense('system_purchase_dec', 'system', 0, $params['purchase_funds'],$params['mark']??'');
|
||||||
$find->purchase_funds = bcsub($params['purchase_funds'], $find['purchase_funds'], 2);
|
$find->purchase_funds = bcsub($params['purchase_funds'], $find['purchase_funds'], 2);
|
||||||
$find->save();
|
$find->save();
|
||||||
}
|
}
|
||||||
@ -267,11 +267,11 @@ class UserLogic extends BaseLogic
|
|||||||
try {
|
try {
|
||||||
$capitalFlowDao = new CapitalFlowLogic($find, 'user');
|
$capitalFlowDao = new CapitalFlowLogic($find, 'user');
|
||||||
if ($params['type'] == 1) {
|
if ($params['type'] == 1) {
|
||||||
$capitalFlowDao->userIncome('system_balance_add', 'system', 0, $params['now_money'],);
|
$capitalFlowDao->userIncome('system_balance_add', 'system', 0, $params['now_money'],$params['mark']??'');
|
||||||
$find->now_money = bcadd($params['now_money'], $find['now_money'], 2);
|
$find->now_money = bcadd($params['now_money'], $find['now_money'], 2);
|
||||||
$find->save();
|
$find->save();
|
||||||
} else {
|
} else {
|
||||||
$capitalFlowDao->userExpense('system_balance_reduce', 'system', 0, $params['now_money']);
|
$capitalFlowDao->userExpense('system_balance_reduce', 'system', 0, $params['now_money'],$params['mark']??'');
|
||||||
$find->now_money = bcsub($params['now_money'], $find['now_money'], 2);
|
$find->now_money = bcsub($params['now_money'], $find['now_money'], 2);
|
||||||
$find->save();
|
$find->save();
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ class BeforehandOrder extends BaseModel
|
|||||||
use SoftDelete;
|
use SoftDelete;
|
||||||
protected $name = 'beforehand_order';
|
protected $name = 'beforehand_order';
|
||||||
protected $deleteTime = 'delete_time';
|
protected $deleteTime = 'delete_time';
|
||||||
|
protected $json = ['other_data'];
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user