优化代码格式,提升代码可读性
This commit is contained in:
parent
67d6fc5a3e
commit
70e58fe432
@ -81,7 +81,7 @@ class SupplierController extends BaseAdminController
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 编辑状态
|
||||
* @notes 供应商审核
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/04/23 16:35
|
||||
@ -91,7 +91,7 @@ class SupplierController extends BaseAdminController
|
||||
$params = (new SupplierValidate())->post()->goCheck('status');
|
||||
$result = SupplierLogic::status($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
return $this->success('审核成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(SupplierLogic::getError());
|
||||
}
|
||||
|
@ -23,7 +23,9 @@ class FinancialRecordLists extends BaseAdminDataLists implements ListsSearchInte
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [];
|
||||
return [
|
||||
"between_time" => 'create_time'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
|
@ -43,6 +43,7 @@ class AdminLogic extends BaseLogic
|
||||
*/
|
||||
public static function add(array $params)
|
||||
{
|
||||
d($params);
|
||||
Db::startTrans();
|
||||
try {
|
||||
$password = password_hash($params['password'],PASSWORD_DEFAULT);
|
||||
|
@ -161,7 +161,8 @@ class MerchantLogic extends BaseLogic
|
||||
$res1 = UserLogic::add($user);
|
||||
if ($res1 == false) {
|
||||
Db::rollback();
|
||||
throw new BusinessException(UserLogic::getError(), 0);
|
||||
self::setError(UserLogic::getError());
|
||||
return false;
|
||||
}
|
||||
$data = [
|
||||
'user_id' => $res1['id'],
|
||||
@ -184,7 +185,13 @@ class MerchantLogic extends BaseLogic
|
||||
}
|
||||
|
||||
if (!empty($apply_info['jg_register_id'])) {
|
||||
(new JgPushService())->sendMsg($apply_info['jg_register_id'], '您的经销入驻请求审核' . ($params['status'] == 1 ? '通过' : '被拒绝'), '/pages/bindDistribution/index');
|
||||
$res=(new JgPushService())->sendMsg($apply_info['jg_register_id'], '您的经销入驻请求审核' . ($params['status'] == 1 ? '通过' : '被拒绝'), '/pages/bindDistribution/index');
|
||||
if($res!==true){
|
||||
Db::rollback();
|
||||
self::setError('极光推送失败:'.$res);
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace app\admin\logic\supplier;
|
||||
|
||||
use app\admin\logic\auth\AdminLogic;
|
||||
use app\admin\logic\user\UserLogic;
|
||||
use app\common\service\JgPushService;
|
||||
use app\common\enum\OrderEnum;
|
||||
@ -108,7 +109,27 @@ class SupplierLogic extends BaseLogic
|
||||
$res1 = UserLogic::add($user);
|
||||
if ($res1 == false) {
|
||||
Db::rollback();
|
||||
throw new BusinessException(UserLogic::getError(), 0);
|
||||
self::setError(UserLogic::getError());
|
||||
return false;
|
||||
}
|
||||
$admin=[
|
||||
'name' => '供应商' . $params['service_phone'],
|
||||
'account' => $params['service_phone'],
|
||||
'dept_id' => [],
|
||||
'jobs_id' => [],
|
||||
'role_id' => [1],
|
||||
'avatar' => '',
|
||||
'password' => $params['service_phone'],
|
||||
'password_confirm' => $params['service_phone'],
|
||||
'disable' => 0,
|
||||
'multipoint_login' => 1,
|
||||
'root' => 0
|
||||
];
|
||||
$res2 = AdminLogic::add($admin);
|
||||
if ($res2 == false) {
|
||||
Db::rollback();
|
||||
self::setError(AdminLogic::getError());
|
||||
return false;
|
||||
}
|
||||
$data = [
|
||||
'user_id' => $res1['id'],
|
||||
@ -117,6 +138,7 @@ class SupplierLogic extends BaseLogic
|
||||
'pid' => $params['id']
|
||||
];
|
||||
Supplier::where('id', $params['id'])->update(['status' => 1, 'uid' => $res1['id']]);
|
||||
|
||||
Db::name('user_auth_shop')->where('id', $params['apply_id'])->update($data);
|
||||
}
|
||||
if ($params['status'] == 0) {
|
||||
@ -204,7 +226,8 @@ class SupplierLogic extends BaseLogic
|
||||
/**
|
||||
* @notes 设置余额
|
||||
*/
|
||||
public static function set_money($id,$set_money,$type=1){
|
||||
public static function set_money($id, $set_money, $type = 1)
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
if ($type == 1) {
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
namespace app\api\controller\financial;
|
||||
|
||||
|
||||
use app\api\controller\BaseApiController;
|
||||
use app\api\lists\financial\FinancialRecordLists;
|
||||
|
||||
@ -46,4 +45,16 @@ class FinancialRecordController extends BaseApiController
|
||||
}
|
||||
return $this->dataLists((new FinancialRecordLists));
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取商户流水统计
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/04/23 10:27
|
||||
*/
|
||||
public function api_lists()
|
||||
{
|
||||
$this->request->__set('is_detail',1);
|
||||
return $this->dataLists((new FinancialRecordLists));
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ use app\admin\lists\BaseAdminDataLists;
|
||||
use app\common\enum\OrderEnum;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\financial\FinancialRecord;
|
||||
use app\common\model\user\User;
|
||||
|
||||
/**
|
||||
* 商户财务记录列表
|
||||
@ -53,8 +54,24 @@ class FinancialRecordLists extends BaseAdminDataLists implements ListsSearchInte
|
||||
];
|
||||
$this->where = $where;
|
||||
$searchWhere=$this->searchWhere;
|
||||
$is_detail=$this->request->__get('is_detail');
|
||||
if($is_detail==1){
|
||||
$list = FinancialRecord::where($this->searchWhere)
|
||||
->where($where)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order('create_time','desc')
|
||||
->select()->each(function ($item) {
|
||||
$item['user_nickname']='';
|
||||
if($item['user_id']!=0){
|
||||
$item['user_nickname']=User::where('id',$item['user_id'])->value('nickname');
|
||||
}
|
||||
$item['financial_pm']=$item['financial_pm']==0?"支出":"获得";
|
||||
return $item;
|
||||
});
|
||||
}else{
|
||||
$list = FinancialRecord::where($this->searchWhere)
|
||||
->where($where)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->field("FROM_UNIXTIME(create_time, '%Y-%m-%d') as record_date, SUM(number) as total_amount")
|
||||
->group('record_date')
|
||||
->order('record_date')
|
||||
@ -63,7 +80,12 @@ class FinancialRecordLists extends BaseAdminDataLists implements ListsSearchInte
|
||||
$item['cashier_total_amount'] = $cashier_total_amount;
|
||||
$cashier_cash_total_amount=FinancialRecord::where($where)->where($searchWhere)->where('financial_type',OrderEnum::CASHIER_CASH_ORDER_PAY)->sum('number');
|
||||
$item['cashier_cash_total_amount'] = $cashier_cash_total_amount;
|
||||
$platofrm_total_amount=FinancialRecord::where($where)->where($searchWhere)->where('financial_type',OrderEnum::USER_ORDER_PAY)->sum('number');
|
||||
$item['platofrm_total_amount'] = $platofrm_total_amount;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
return $list?->toArray();
|
||||
}
|
||||
|
||||
|
@ -66,10 +66,12 @@ class OrderEnum
|
||||
self::USER_ORDER_PAY=>'用户订单支付',
|
||||
self::MERCHANT_ORDER_PAY=>'商户订单支付',
|
||||
self::PLATFORM_ORDER_PAY=>'平台订单支付',
|
||||
self::MERCHANT_ORDER_OBTAINS=>'商户订单提现',
|
||||
self::MERCHANT_ORDER_OBTAINS=>'商户订单获得',
|
||||
self::ORDER_HANDLING_FEES=>'订单手续费',
|
||||
self::PLATFORM_ORDER_OBTAINS=>'平台订单获得',
|
||||
self::SUPPLIER_ORDER_OBTAINS=>'供应商订单获得',
|
||||
self::SYSTEM_SET=>'平台设置',
|
||||
|
||||
|
||||
];
|
||||
if ($value === true) {
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
use JPush\Client;
|
||||
use support\Log;
|
||||
use support\exception\BusinessException;
|
||||
|
||||
|
||||
class JgPushService
|
||||
@ -34,9 +35,10 @@
|
||||
$this->push->iosNotification($message, ['extras' => ['route' => $route, 'type' => $type]]);
|
||||
$this->push->send();
|
||||
unset($this->client, $this->push);
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
dump($e->getMessage());
|
||||
Log::error($e->getMessage());
|
||||
return $e->getMessage();
|
||||
}
|
||||
try {
|
||||
$this->client = new Client($this->azKey, $this->azSecret);
|
||||
@ -46,9 +48,11 @@
|
||||
$this->push->androidNotification($message, ['extras' => ['route' => $route, 'type' => $type]]);
|
||||
$this->push->send();
|
||||
unset($this->client, $this->push);
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
dump($e->getMessage());
|
||||
Log::error($e->getMessage());
|
||||
return $e->getMessage();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user