138 lines
6.5 KiB
PHP
138 lines
6.5 KiB
PHP
<?php
|
||
|
||
/**
|
||
* @author Any
|
||
* @description KISS
|
||
* @date 2021年6月9日
|
||
* @version 1.0.0
|
||
*
|
||
* _____LOG_____
|
||
*
|
||
*/
|
||
namespace app\modules\api\controllers;
|
||
|
||
use app\modules\api\behaviors\LoginBehavior;
|
||
use app\components\SiteHelper;
|
||
use app\components\SysConst;
|
||
use app\models\common\CommonCashListForm;
|
||
use app\models\common\CommonCashSubmitForm;
|
||
use app\models\common\CommonCashActionForm;
|
||
use app\models\Cash;
|
||
use app\models\Balance;
|
||
|
||
class CashController extends Controller
|
||
{
|
||
public function behaviors() {
|
||
return array_merge(parent::behaviors(),[
|
||
'login' => [
|
||
'class' => LoginBehavior::className(),
|
||
'ignore' => [
|
||
]
|
||
]
|
||
]);
|
||
}
|
||
|
||
/**
|
||
* hidedoc
|
||
* @catalog 用户信息/账户提现
|
||
* @title 钱包余额提现明细列表
|
||
* @description 本接口提供钱包余额提现明细
|
||
* @method get
|
||
* @url /api/cash/index
|
||
* @param keywords 非必选 string 关键词
|
||
* @param page 必选 int 页码
|
||
* @param limit 非必选 int 每页记录数
|
||
* @param start_time 非必选 string 开始时间
|
||
* @param end_time 非必选 string 结束时间
|
||
* @return {"code":0,"msg":"ok","data":[{"nickname":"admin","avatar_url":"http://app.tpl.dev.1nww.com/statics/images/avatar.jpg","real_name":"","id":"3","cx_mch_id":"0","user_id":"1","scene":"0","money":"9.00","service_charge":"0.90","order_no":"202106091845521003558924","status":"0","transfer_status":"0","alipay_account":"","alipay_account_name":"","bank_name":"","bank_card_no":"","cash_type":"1","pay_type":"0","pay_time":"0","created_at":"1623235552","review_time":null,"review_comment":"","remark":"","created_at_cn":"2021-06-09 18:45:52","pay_time_cn":"1970-01-01 08:00:00","review_time_cn":"1970-01-01 08:00:00","status_cn":"待处理","transfer_status_cn":"待转账","cash_type_cn":"微信","pay_type_cn":"未知"}],"count":"3","page_size":20,"page_count":1,"page_no":1,"end_flag":false}
|
||
* @return_param count int 记录条数
|
||
* @return_param page_size int 每页记录数
|
||
* @return_param page_count int 总页数
|
||
* @return_param page_no int 当前页码
|
||
* @return_param end_flag bool 是否加载结束
|
||
* @remark
|
||
*/
|
||
public function actionIndex()
|
||
{
|
||
$form = new CommonCashListForm();
|
||
$form->scenario = 'user';
|
||
$form->attributes = \Yii::$app->request->get();
|
||
$form->scene = Balance::$cxBalanceSceneUserWallet;
|
||
$form->cx_mch_id = $this->cx_mch_id;
|
||
$form->user_id = \Yii::$app->user->identity->id;
|
||
$data = $form->search();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
/**
|
||
* hidedoc
|
||
* @catalog 用户信息/账户提现
|
||
* @title 发起钱包余额提现
|
||
* @description 本接口提供发起钱包余额提现
|
||
* @method post
|
||
* @url /api/cash/apply
|
||
* @param money 必选 number 提现金额
|
||
* @param cash_type 必选 int 提现类型
|
||
* @param wechat_account 非必选 string 微信账号
|
||
* @param wechat_account_name 非必选 string 微信账号持有者姓名
|
||
* @param alipay_account 非必选 string 支付宝账号
|
||
* @param alipay_account_name 非必选 string 支付宝账号持有者姓名
|
||
* @param bank_name 非必选 string 银行名称
|
||
* @param bank_card_no 非必选 string 银行卡号
|
||
* @param bank_card_name 非必选 string 银行卡持卡人姓名
|
||
* @return {"code":0,"msg":"提现申请成功","data":[]}
|
||
* @return_param account_balance number 钱包余额
|
||
* @return_param cash_setting['min_cash'] number 最低提现金额
|
||
* @return_param cash_setting['max_cash'] number 最高提现金额
|
||
* @return_param cash_setting['cash_types'] JSON 提现类型
|
||
* @return_param cash_setting['service_charge'] number 提现费率
|
||
* @remark method=get时获取提现规则及钱包余额信息
|
||
*/
|
||
public function actionApply()
|
||
{
|
||
$form = new CommonCashSubmitForm();
|
||
if(\Yii::$app->request->isPost){
|
||
$form->scenario = 'save';
|
||
$form->attributes = \Yii::$app->request->post();
|
||
$form->scene = Balance::$cxBalanceSceneUserWallet;
|
||
$form->cx_mch_id = $this->cx_mch_id;
|
||
$form->user_id = \Yii::$app->user->identity->id;
|
||
$data = $form->save();
|
||
return $this->responseHandler($data);
|
||
}
|
||
$form->scene = Balance::$cxBalanceSceneUserWallet;
|
||
$form->cx_mch_id = $this->cx_mch_id;
|
||
$form->user_id = \Yii::$app->user->identity->id;
|
||
$data = $form->search();
|
||
return $this->responseHandler($data);
|
||
}
|
||
|
||
|
||
/**
|
||
* hidedoc
|
||
* @catalog 用户信息/账户提现
|
||
* @title 钱包余额提现明细详情
|
||
* @description 本接口提供钱包余额提现详情
|
||
* @method get
|
||
* @url /api/cash/detail
|
||
* @param cash_id 必选 int 提现ID
|
||
* @return {"code":0,"msg":"ok","data":{"nickname":"zZ","avatar_url":"https://thirdwx.qlogo.cn/mmopen/vi_32/DYAIOgq83eqSl7uAQAD8l0RsjUU4fOQxhl3Qv1icdFxOcGGFadhCHM0nLhkpkvOefbrOZxicZJtXic2SNtpTzBhbA/132","real_name":"","id":"25","cx_mch_id":"0","user_id":"2","scene":"0","money":"0.30","service_charge":"0.00","order_no":"202106151124170106375441","status":"1","transfer_status":"1","wechat_account":"","wechat_account_name":"","alipay_account":"","alipay_account_name":"","bank_name":"","bank_card_no":"","bank_card_name":"","cash_type":"0","pay_type":"1","pay_time":"1623727458","created_at":"1623727457","review_time":"1623727457","review_comment":"自动打款审核","remark":"","created_at_cn":"2021-06-15 11:24:17","pay_time_cn":"2021-06-15 11:24:18","review_time_cn":"2021-06-15 11:24:17","status_cn":"已同意","transfer_status_cn":"已转账","cash_type_cn":"自动打款","pay_type_cn":"微信","scene_cn":"钱包提现","cnd":30,"actual_money":"0.30","cash_type_info":"自动打款 / --","cash_money_info":"提现金额:¥0.30 / 服务费:¥0.00 / 实际到账:¥0.30"}}
|
||
* @return_param param param_type param_desc
|
||
* @remark
|
||
*/
|
||
public function actionDetail()
|
||
{
|
||
$form = new CommonCashActionForm();
|
||
$form->scenario = 'detail';
|
||
$form->attributes = \Yii::$app->request->get();
|
||
$form->cx_mch_id = $this->cx_mch_id;
|
||
$form->user_id = \Yii::$app->user->identity->id;
|
||
$form->scene = Balance::$cxBalanceSceneUserWallet;
|
||
$data = $form->detail();
|
||
return $this->responseHandler($data);
|
||
}
|
||
}
|
||
|
||
|
||
|