diff --git a/app/Controller/DoctorAccountController.php b/app/Controller/DoctorAccountController.php index 476d702..92e0850 100644 --- a/app/Controller/DoctorAccountController.php +++ b/app/Controller/DoctorAccountController.php @@ -68,4 +68,20 @@ class DoctorAccountController extends AbstractController $data = $DoctorAccountService->getDoctorWithdrawalOrderList(); return $this->response->json($data); } + + /** + * 获取医生提现记录列表 + * @return ResponseInterface + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ + public function getDoctorWithdrawalRecordList(): ResponseInterface + { + $request = $this->container->get(DoctorAccountRequest::class); + $request->scene('getDoctorWithdrawalRecordList')->validateResolved(); + + $DoctorAccountService = new DoctorAccountService(); + $data = $DoctorAccountService->getDoctorWithdrawalRecordList(); + return $this->response->json($data); + } } \ No newline at end of file diff --git a/app/Model/DoctorWithdrawal.php b/app/Model/DoctorWithdrawal.php index 7c13b17..7356f18 100644 --- a/app/Model/DoctorWithdrawal.php +++ b/app/Model/DoctorWithdrawal.php @@ -6,12 +6,13 @@ namespace App\Model; +use Hyperf\Database\Model\Collection; use Hyperf\Snowflake\Concern\Snowflake; /** * @property int $withdrawal_id 主键id * @property int $doctor_id 医生id - * @property int $bank_card_id 医生银行卡id + * @property int $bank_id 银行id * @property string $account_name 银行卡姓名 * @property string $bank_card_code 银行卡号 * @property string $bank_card_code_four 银行卡号(后四位) @@ -36,12 +37,12 @@ class DoctorWithdrawal extends Model /** * The attributes that are mass assignable. */ - protected array $fillable = ['withdrawal_id', 'doctor_id', 'bank_card_id', 'account_name', 'bank_card_code', 'bank_card_code_four', 'applied_withdrawal_amount', 'actual_withdrawal_amount', 'income_tax', 'examine_status', 'examine_fail_reason', 'examine_time', 'created_at', 'updated_at']; + protected array $fillable = ['withdrawal_id', 'doctor_id', 'bank_id', 'account_name', 'bank_card_code', 'bank_card_code_four', 'applied_withdrawal_amount', 'actual_withdrawal_amount', 'income_tax', 'examine_status', 'examine_fail_reason', 'examine_time', 'created_at', 'updated_at']; /** * The attributes that should be cast to native types. */ - protected array $casts = ['withdrawal_id' => 'integer', 'doctor_id' => 'integer', 'bank_card_id' => 'integer', 'examine_status' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime']; + protected array $casts = ['withdrawal_id' => 'integer', 'doctor_id' => 'integer', 'bank_id' => 'integer', 'examine_status' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime']; protected string $primaryKey = "withdrawal_id"; @@ -66,4 +67,16 @@ class DoctorWithdrawal extends Model { return self::where($params)->get($fields); } + + /** + * 获取某一时间区间数据 + * @param array $params + * @param array $created_at_params + * @param array $fields + * @return Collection|array + */ + public static function getDateList(array $params,array $created_at_params, array $fields = ['*']): Collection|array + { + return self::where($params)->whereBetween('created_at',$created_at_params)->get($fields); + } } diff --git a/app/Request/DoctorAccountRequest.php b/app/Request/DoctorAccountRequest.php index 41bffe4..1fcfe99 100644 --- a/app/Request/DoctorAccountRequest.php +++ b/app/Request/DoctorAccountRequest.php @@ -16,6 +16,9 @@ class DoctorAccountRequest extends FormRequest 'getDoctorAccountInfo' => [ // 获取我的账户日账单明细数据 'date', ], + 'getDoctorWithdrawalRecordList' => [ // 获取医生提现记录列表 + 'year', + ], ]; /** @@ -33,6 +36,7 @@ class DoctorAccountRequest extends FormRequest { return [ 'date' => 'required', + 'year' => 'required', ]; } @@ -43,6 +47,7 @@ class DoctorAccountRequest extends FormRequest { return [ 'date.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), + 'year.required' => HttpEnumCode::getMessage(HttpEnumCode::CLIENT_HTTP_ERROR), ]; } } diff --git a/app/Services/CodeService.php b/app/Services/CodeService.php index 31319a9..72ca923 100644 --- a/app/Services/CodeService.php +++ b/app/Services/CodeService.php @@ -41,7 +41,7 @@ class CodeService extends BaseService $template_code = "SMS_243055263"; $template_param = array(); - $template_param['code'] = (int)substr($generator->generate(),-4); + $template_param['code'] = mt_rand(1,9) . (int)substr($generator->generate(),-3); // 发送短信 Dysms::sendSms($phone,$template_param,$template_code,1); diff --git a/app/Services/DoctorAccountService.php b/app/Services/DoctorAccountService.php index 77a0ec7..cdcacae 100644 --- a/app/Services/DoctorAccountService.php +++ b/app/Services/DoctorAccountService.php @@ -245,8 +245,26 @@ class DoctorAccountService extends BaseService return success($order_inquiry); } + // 获取医生提现记录列表 + public function getDoctorWithdrawalRecordList(): array + { + $user_info = $this->request->getAttribute("userInfo") ?? []; + + $year = $this->request->input('year'); + + // 获取当年开始时间 + $start_date = $year.'-1-1 00:00:00'; + + // 获取当年结束时间 + $end_date = $year.'-12-31 23:59:59'; + + $created_at_params = [$start_date, $end_date]; + + $params = array(); + $params['doctor_id'] = $user_info['client_user_id']; + } /** * 获取医生账户余额 diff --git a/config/routes.php b/config/routes.php index 8b3b9c3..3ad71c5 100644 --- a/config/routes.php +++ b/config/routes.php @@ -114,6 +114,9 @@ Router::addGroup('/doctor', function () { // 获取可提现问诊订单列表 Router::get('/order', [DoctorAccountController::class, 'getDoctorWithdrawalOrderList']); + + // 获取医生提现记录列表 + Router::get('/record', [DoctorAccountController::class, 'getDoctorWithdrawalRecordList']); }); // 订单