Commit 11e1b828 authored by twj's avatar twj

Merge branch 'dev' of http://rungit.jxdsy.cn:10000/sugar/introducer into dev

parents 720ca075 b466daea
......@@ -64,6 +64,7 @@ class Order extends Backend
}
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
$list = $this->model
->with('usermoneylog')
->where($where)
->where($device_where)
->order($sort, $order)
......
<?php
namespace app\admin\controller\users;
use app\common\controller\Backend;
use think\Db;
/**
* 会员余额变动管理
*
* @icon fa fa-circle-o
*/
class Usermoneylog extends Backend
{
/**
* Usermoneylog模型对象
* @var \app\admin\model\users\Usermoneylog
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\users\Usermoneylog;
$this->view->assign("heatosList", $this->model->getHeatosList());
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
/**
* 查看
*
* @return string|Json
* @throws \think\Exception
* @throws DbException
*/
public function index()
{
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
if (false === $this->request->isAjax()) {
return $this->view->fetch();
}
//如果发送的来源是 Selectpage,则转发到 Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
$list = $this->model
->with('users')
->where($where)
->where(['type' =>13])
->order($sort, $order)
->paginate($limit);
$result = ['total' => $list->total(), 'rows' => $list->items()];
return json($result);
}
/**
* 添加
*
* @return string
* @throws \think\Exception
*/
public function add()
{
if (false === $this->request->isPost()) {
return $this->view->fetch();
}
$params = $this->request->post('row/a');
if (empty($params)) {
$this->error(__('Parameter %s can not be empty', ''));
}
$params = $this->preExcludeFields($params);
if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
$params[$this->dataLimitField] = $this->auth->id;
}
$result = false;
Db::startTrans();
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
$this->model->validateFailException()->validate($validate);
}
$result = $this->model->allowField(true)->save($params);
Db::commit();
} catch (ValidateException|PDOException|Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($result === false) {
$this->error(__('No rows were inserted'));
}
$this->success();
}
/**
* 编辑
*
* @param $ids
* @return string
* @throws DbException
* @throws \think\Exception
*/
public function edit($ids = null)
{
$row = $this->model->get($ids);
if (!$row) {
$this->error(__('No Results were found'));
}
$adminIds = $this->getDataLimitAdminIds();
if (is_array($adminIds) && !in_array($row[$this->dataLimitField], $adminIds)) {
$this->error(__('You have no permission'));
}
if (false === $this->request->isPost()) {
$this->view->assign('row', $row);
return $this->view->fetch();
}
$params = $this->request->post('row/a');
if (empty($params)) {
$this->error(__('Parameter %s can not be empty', ''));
}
$params = $this->preExcludeFields($params);
$result = false;
Db::startTrans();
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
$row->validateFailException()->validate($validate);
}
$result = $row->allowField(true)->save($params);
Db::commit();
} catch (ValidateException|PDOException|Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if (false === $result) {
$this->error(__('No rows were updated'));
}
$this->success();
}
}
......@@ -244,6 +244,67 @@ class Users extends Backend
return $this->view->fetch();
}
/**
* @param null $ids
* 增减股权
*/
public function editEquity($ids = null)
{
$row = $this->model->get(['id' => $ids]);
if (!$row) {
$this->error(__('No Results were found'));
}
$adminIds = $this->getDataLimitAdminIds();
if (is_array($adminIds)) {
if (!in_array($row[$this->dataLimitField], $adminIds)) {
$this->error(__('You have no permission'));
}
}
if ($this->request->isPost()) {
$params = $this->request->post('row/a');
if ($params) {
$equity = $params['equity'];
if ($params['equity'] == 0) {
$this->error('请输入正确的股权数');
}
if (((int)$row['equity'] + $params['equity']) < 0) {
$this->error('股权余额不足!');
}
$info = $this->model->where(['id' => $row['id']])->find();
/* if($params['equity'] > 0 && !$params['equity_code']){
$this->error('请输入股权代码!');
}
$equity_code = $params['equity_code'];
if($info['equity'] && $equity>0){
$info['equity_code'] .= '+'.$params['equity_code'];
$equity_code = $info['equity_code'];
}
$params['signtime'] = strtotime($params['signtime']);
if($equity_code && $params['equity'] > 0){
$this->model->where(['id' => $row['id']])->update(['equity_code' =>$equity_code,'signtime' =>$params['signtime']]);
}*/
$this->model->where(['id' => $row['id']])->setInc('equity', $equity);
$data = [
'user_id' => $row['id'],
'money' => $equity,
'before' => (int)$row['equity'],
'after' => (int)$row['equity'] + $equity,
'memo' => $params['equity_code'],
'type' => 13,
'heatos' => $params['equity'] > 0 ? 1:-1,
'createtime' => time(),
];
UserMoneyLog::create($data);
$this->success();
} else {
$this->error('数据错误,请重新打开窗口!user_id', $row['id']);
}
}
$this->view->assign("row", $row);
return $this->view->fetch();
}
/**
* @return string
* 订单编号
......
......@@ -288,7 +288,7 @@ class Withdraw extends Backend
}
switch ($row['withdraw_way']){
case 1://提现至零钱
$result = $wxpayConstants->crteateMchPayV2($usersinfo['wx_openid'], $desc, $row['cash_sn'], $row['money'], $row['name'], $jsonMap);
$result = $wxpayConstants->transfer($usersinfo['wx_openid'], $desc, $row['cash_sn'], $row['money'], $row['name'], $jsonMap);
break;
case 2://提现至银行卡
if($withraw_money <= 1000*100){
......
<?php
return [
'User_id' => '会员ID',
'Money' => '变更股权',
'Before' => '变更前股权',
'After' => '变更后股权',
'Memo' => '备注',
'Createtime' => '创建时间',
'Heatos' => '金额类型',
'Heatos 1' => '增加',
'Heatos -1' => '减少',
'Logs_id' => '支付记录id'
];
......@@ -70,5 +70,8 @@ class Order extends Model
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
}
public function usermoneylog(){
return self::hasOne("app\admin\model\users\Usermoneylog",'order_id',"id");
}
}
<?php
namespace app\admin\model\users;
use think\Model;
class Usermoneylog extends Model
{
// 表名
protected $name = 'user_money_log';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'integer';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = false;
protected $deleteTime = false;
// 追加属性
protected $append = [
'heatos_text'
];
public function getHeatosList()
{
return ['1' => __('Heatos 1'), '-1' => __('Heatos -1')];
}
public function getHeatosTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['heatos']) ? $data['heatos'] : '');
$list = $this->getHeatosList();
return isset($list[$value]) ? $list[$value] : '';
}
public function users()
{
return self::hasOne("app\admin\model\users\Users",'id',"user_id");
}
}
<?php
namespace app\admin\validate\users;
use think\Validate;
class Usermoneylog extends Validate
{
/**
* 验证规则
*/
protected $rule = [
];
/**
* 提示消息
*/
protected $message = [
];
/**
* 验证场景
*/
protected $scene = [
'add' => [],
'edit' => [],
];
}
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-user_id" data-rule="required" min="0" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Money')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-money" data-rule="required" class="form-control" step="0.01" name="row[money]" type="number">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Before')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-before" data-rule="required" class="form-control" step="0.01" name="row[before]" type="number">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('After')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-after" data-rule="required" class="form-control" step="0.01" name="row[after]" type="number">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Memo')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-memo" class="form-control" name="row[memo]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Heatos')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-heatos" class="form-control selectpicker" name="row[heatos]">
{foreach name="heatosList" item="vo"}
<option value="{$key}" {in name="key" value="1"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Logs_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-logs_id" data-rule="required" data-source="logs/index" class="form-control selectpage" name="row[logs_id]" type="text" value="">
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div>
</div>
</form>
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-user_id" data-rule="required" min="0" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="{$row.user_id|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Money')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-money" data-rule="required" class="form-control" step="0.01" name="row[money]" type="number" value="{$row.money|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Before')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-before" data-rule="required" class="form-control" step="0.01" name="row[before]" type="number" value="{$row.before|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('After')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-after" data-rule="required" class="form-control" step="0.01" name="row[after]" type="number" value="{$row.after|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Memo')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-memo" class="form-control" name="row[memo]" type="text" value="{$row.memo|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Heatos')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-heatos" class="form-control selectpicker" name="row[heatos]">
{foreach name="heatosList" item="vo"}
<option value="{$key}" {in name="key" value="$row.heatos"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Logs_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-logs_id" data-rule="required" data-source="logs/index" class="form-control selectpage" name="row[logs_id]" type="text" value="{$row.logs_id|htmlentities}">
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div>
</div>
</form>
<div class="panel panel-default panel-intro">
{:build_heading()}
<div class="panel-body">
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade active in" id="one">
<div class="widget-body no-padding">
<div id="toolbar" class="toolbar">
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
<div class="dropdown btn-group {:$auth->check('users/usermoneylog/multi')?'':'hide'}">
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
<ul class="dropdown-menu text-left" role="menu">
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>
</ul>
</div>
</div>
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
data-operate-edit=""
data-operate-del=""
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>
<!--
* @Author: your name
* @Date: 2021-01-07 15:21:12
* @LastEditTime: 2023-05-22 16:27:08
* @LastEditors: taowj 965042433@qq.com
* @Description: In User Settings Edit
* @FilePath: \luma_fastadmin\application\admin\view\user\users\editlmgu.html
-->
<form id="editlmgu-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('股份的数量:')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-Equity" class="form-control" name="row[equity]" type="number">
{:__('减少请输入负数')}
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">备注:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-Equity_code" class="form-control" name="row[equity_code]"></textarea>
{:__('减少此栏请填写原因')}
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">签发时间:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-Signtime" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[signtime]" type="text" value="">
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-success btn-embossed">{:__('OK')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div>
</div>
</form>
\ No newline at end of file
......@@ -36,7 +36,7 @@ use think\Session;
class Users extends Api
{
protected $noNeedLogin = ['wxlogin', 'create_code'];
protected $noNeedLogin = ['wxlogin', 'create_code','createcode','querymerchantdetails'];
protected $noNeedRight = ['*'];
/*
......@@ -102,6 +102,8 @@ class Users extends Api
'jointime' => time(),
'loginip' => $this->request->ip(),
'salt' => $salt,
'random_number' =>$this->recursion(),
// 'random_number' =>createRandomcode(),
];
$users = UsersModel::create($users_arr);
......@@ -393,10 +395,14 @@ class Users extends Api
$page = $this->request->post('page', 1);
$usersinfo = UsersModel::where(['id' => $this->auth->id])->find();
$Transfers = Db::name('user_money_log')
->where(['user_id' => $this->auth->id, 'type' => 3])
->field('*,FROM_UNIXTIME(createtime,"%Y-%m-%d %H:%i") as createtime')
->alias('uml')
->join('users u','u.id = uml.transfer_user_id','left')
->join('users us','us.id = uml.user_id','left')
->where(['uml.user_id' => $this->auth->id, 'uml.type' => 3])
->field('uml.*,FROM_UNIXTIME(uml.createtime,"%Y-%m-%d %H:%i") as createtime,u.transfer_random_number,us.random_number')
->page($page)
->limit($this->pageSize)
->order('uml.createtime desc')
->select();
$this->success('获取成功', ['total_money' => $usersinfo['total_money'], 'Transfers' => $Transfers]);
}
......@@ -575,6 +581,7 @@ class Users extends Api
{
$uid = $this->auth->id;
$user_id = $this->request->param("user_id", 0); //收款用户ID
$random_number = $this->request->param("random_number", 0); //收款用户ID
$money = $this->request->param('money', 0);
if ($money <= 0) { //检测余额小于0,用户余额是不是不足,超过最大限制,最小限制,检测用户转账间隔时间
$this->error("您输入的金额不合法!");
......@@ -589,7 +596,9 @@ class Users extends Api
if ($money > $userinfo['total_money']) {
$this->error("转账金额有误!");
}
$transferuserinfo = UsersModel::where(['id' => $user_id])->find();
// $transferuserinfo = UsersModel::where(['id' => $user_id])->find();
$transferuserinfo = UsersModel::where(['random_number' => $random_number])->find();
$user_id = $transferuserinfo['id'];
$user_after = sprintf('%.2f', $userinfo['total_money'] - $money);
$user_intro = '您给' . $transferuserinfo['nickname'] . '转账了' . $money . '元';
self::addMoney($uid, -$money, $userinfo['total_money'], $user_after, $user_intro, 0, 3, $user_id); //转账人减少相应金额
......@@ -774,7 +783,7 @@ class Users extends Api
public function myBill()
{
$page = $this->request->param('page', 1);
$type = $this->request->param('type', 9); //9购物金
$type = $this->request->param('type', 9); //9购物金 13股权股票变更
$heatos = $this->request->param('heatos', 0); //1正数收入,-1负数支出
$where = [];
$where['user_id'] = $this->auth->id;
......@@ -797,9 +806,6 @@ class Users extends Api
case 1:
$val['money'] = '+' . $val['money'];
break;
case -1:
$val['money'] = '-' . $val['money'];
break;
}
}
$this->success('获取账单明细成功', ['userdetailmoneys' => $userdetailmoneys]);
......@@ -830,4 +836,51 @@ class Users extends Api
$companyInfo['chairman_seal'] = "";
$this->success('获取股权信息成功', ['equityInfo' => $userInfo, 'companyInfo' => $companyInfo]);
}
/**
* 批量随机编号
*/
public function createCode(){
$info = UsersModel::order('id desc')->field('id')->find();
$lastid = $info['id'];
for ($x = 1; $x <= $lastid; $x++){
$random_number = $this->recursion();
/* $random_number = createRandomcode();
$info = UsersModel::where(['random_number' =>$random_number])->find();
if($info){
$random_number = createRandomcode();
}*/
UsersModel::where(['id' =>$x])->update(['random_number' =>$random_number]);
}
$this->success('生成成功');
}
/**
* @return string
* 递归查询
*/
private function recursion(){
$random_number = createRandomcode();
$info = UsersModel::where(['random_number' =>$random_number])->find();
if($info){
$this->recursion();
}
return $random_number;
}
/**
* 商家明细单号查询
*/
public function queryMerchantDetails(){
$data=Withdraw::where(['status'=>1,'out_batch_no'=>['NEQ','NULL'],'detail_status'=>null])->select();
foreach ($data as $key=>$val){
$jsonMap=new ErrorInfo();
$result=WXPayConstants::detailsQuery($val['out_batch_no'],$val['cash_sn'],$jsonMap);
if ($jsonMap->code < 0) {
Withdraw::where(['id'=>$val['id']])->update(['status'=>0,'reason'=>$jsonMap->msg,'detail_status'=>$jsonMap->fail_reason]);
}else{
Withdraw::where(['id'=>$val['id']])->update(['detail_status'=>"SUCCESS"]);
}
}
}
}
......@@ -715,4 +715,27 @@ EOT;
return $file;
}
}
if (!function_exists('createRandomcode')) {
/**
* 生成字母和数字组成的7位字符串
*/
function createRandomcode()
{
/* // 生成字母和数字组成的7位字符串
$str = range('A', 'Z');
// 去除大写的O,以防止与0混淆 
unset($str[array_search('O', $str)]);
$arr = array_merge(range(0, 9), $str);*/
$arr = range(0, 9);
shuffle($arr);
$invitecode = '';
$arr_len = count($arr);
for ($i = 0; $i < 7; $i++) {
$rand = mt_rand(0, $arr_len - 1);
$invitecode .= $arr[$rand];
}
return $invitecode;
}
}
}
......@@ -9,6 +9,7 @@
namespace app\lib\utils\WXPay;
use app\admin\model\users\Withdraw;
use think\Config;
use think\Log;
......@@ -435,7 +436,7 @@ class WXPayConstants
//请求参数
$data = [
'appid' => $that->APPID, //申请商户号的appid或商户号绑定的appid(企业号corpid即为此appid)
'out_batch_no' => 'ycz' . date('Ymd') . mt_rand(1000, 9999), //商户系统内部的商家批次单号,要求此参数只能由数字、大小写字母组成,在商户系统内部唯一
'out_batch_no' => 'ycz' . date('Ymd') . mt_rand(100000, 999999), //商户系统内部的商家批次单号,要求此参数只能由数字、大小写字母组成,在商户系统内部唯一
'batch_name' => $body, //该笔批量转账的名称
'batch_remark' => $body, //转账说明,UTF8编码,最多允许32个字符
'total_amount' => floatval($total_fee), //转账金额单位为“分”。转账总金额必须与批次内所有明细转账金额之和保持一致,否则无法发起转账操作
......@@ -454,13 +455,14 @@ class WXPayConstants
Log::write("token:" . $token);
$result = self::https_request($url, json_encode($data), $token); //发送请求
$result_arr = json_decode($result, true);
if (!isset($result_arr['create_time'])) { //批次受理失败
throw new \Exception($result_arr['message']);
Log::write("提现异常:" . $result_arr['message']);
$error->code = -3;
$error->msg = $result_arr['message'];
return $error;
}
//批次受理成功,进行操作
Withdraw::where(['cash_sn' =>$out_trade_no])->update(['out_batch_no' =>$data['out_batch_no']]);//更新商家批次单号
return true;
}
......@@ -556,10 +558,10 @@ class WXPayConstants
/**
* @notes 商家明细单号查询
*/
public static function detailsQuery($withdrawApply)
public static function detailsQuery($withdrawApply,$error)
{
//请求URL
$url = 'https://api.mch.weixin.qq.com/v3/transfer/batches/out-batch-no/' . $withdrawApply['batch_no'] . '/details/out-detail-no/' . $withdrawApply['sn'];
$url = 'https://api.mch.weixin.qq.com/v3/transfer/batches/out-batch-no/' . $withdrawApply['out_batch_no'] . '/details/out-detail-no/' . $withdrawApply['cash_sn'];
//请求方式
$http_method = 'GET';
//请求参数
......@@ -567,6 +569,52 @@ class WXPayConstants
$token = self::token($url, $http_method, $data); //获取token
$result = self::https_request($url, $data, $token); //发送请求
$result_arr = json_decode($result, true);
return $result_arr;
if(isset($result_arr['code']) && !empty($result_arr['code'])){
$error->fail_reason = $result_arr['code'];
$error->code = -3;
$error->msg = $result_arr['message'];
return $error;
}else if(isset($result_arr['fail_reason']) && !empty($result_arr['fail_reason'])){
$error->fail_reason = $result_arr['fail_reason'];
if($result_arr['fail_reason'] === "ACCOUNT_FROZEN"){
$error->code = -3;
$error->msg = "该用户账户被冻结";
return $error;
}else if($result_arr['fail_reason'] === "REAL_NAME_CHECK_FAIL"){
$error->code = -3;
$error->msg = "收款人未实名认证,需要用户完成微信实名认证";
return $error;
}else if($result_arr['fail_reason'] === "NAME_NOT_CORRECT"){
$error->code = -3;
$error->msg = "收款人姓名校验不通过,请核实信息";
return $error;
}else if($result_arr['fail_reason'] === "OPENID_INVALID"){
$error->code = -3;
$error->msg = "Openid格式错误或者不属于商家公众账号";
return $error;
}else if($result_arr['fail_reason'] === "TRANSFER_QUOTA_EXCEED"){
$error->code = -3;
$error->msg = "超过用户单笔收款额度,核实产品设置是否准确";
return $error;
}else if($result_arr['fail_reason'] === "DAY_RECEIVED_QUOTA_EXCEED"){
$error->code = -3;
$error->msg = "超过用户单日收款额度,核实产品设置是否准确";
return $error;
}else if($result_arr['fail_reason'] === "DAY_RECEIVED_COUNT_EXCEED"){
$error->code = -3;
$error->msg = "超过用户单日收款次数,核实产品设置是否准确";
return $error;
}else if($result_arr['fail_reason'] === "TRANSFER_RISK"){
$error->code = -3;
$error->msg = "该笔转账可能存在风险,已被微信拦截";
return $error;
}else {
$error->code = -3;
$error->msg = $result_arr['fail_reason'];
//$error->msg = "对不起,查询微信转账明细接口调用错误!";
return $error;
}
}
return true;
}
}
......@@ -39,10 +39,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'need_pay', title: __('Need_pay'), operate:'BETWEEN'},
{field: 'device_sign', title: __('Device_sign'), operate: 'LIKE'},
{field: 'num', title: __('Num'), operate: 'LIKE'},
{field: 'order_type', title: __('Order_type'), searchList: {"0":__('Order_type 0'),"2":__('Order_type 2'),"4":__('Order_type 4'),"5":__('Order_type 5')}, formatter: Table.api.formatter.normal},
{field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3'),"4":__('Status 4'),"5":__('Status 5')}, formatter: Table.api.formatter.status},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'endtime', title: __('Endtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'order_type', title: __('Order_type'), searchList: {"0":__('Order_type 0'),"2":__('Order_type 2'),"4":__('Order_type 4'),"5":__('Order_type 5'),"6":__('Order_type 6'),"7":__('Order_type 7'),"8":__('Order_type 8')}, formatter: Table.api.formatter.normal},
{field: 'status', title: __('Status'), visible: false, searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3'),"4":__('Status 4'),"5":__('Status 5')}, formatter: Table.api.formatter.status},
{field: 'usermoneylog.memo', title: __('备注'), operate: 'LIKE'},
{field: 'createtime', title: __('Createtime'), visible: false, operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'endtime', title: __('Endtime'), visible: false, operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
......
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'users/usermoneylog/index' + location.search,
add_url: 'users/usermoneylog/add',
edit_url: 'users/usermoneylog/edit',
del_url: 'users/usermoneylog/del',
multi_url: 'users/usermoneylog/multi',
import_url: 'users/usermoneylog/import',
table: 'user_money_log',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{
field: 'user_id', title: __('User_id'),
formatter: function (value, row, index) {
if (row.users) {
var html = "id:" + row.user_id + "<br/> 昵称:" + row.users.nickname;
html = row.users.realname ? html + "<br/> 姓名:" + row.users.realname : html;
html = row.users.mobile ? html + "<br/> 电话:" + row.users.mobile : html;
return html;
} else {
return "id:" + row.user_id;
}
}
},
{field: 'money', title: __('Money'), operate:false},
{field: 'before', title: __('Before'), operate:false},
{field: 'after', title: __('After'), operate:false},
{field: 'memo', title: __('Memo'), operate: 'LIKE'},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'heatos', title: __('Heatos'), searchList: {"1":__('Heatos 1'),"-1":__('Heatos -1')}, formatter: Table.api.formatter.normal},
{field: 'logs_id', title: __('Logs_id'), visible: false},
{field: 'operate', title: __('Operate'), visible: false, table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});
......@@ -8,6 +8,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
index_url: 'users/users/index' + location.search,
editMoney_url: 'users/users/editMoney',
editShoppingMoney_url: 'users/users/editShoppingMoney',
editEquity: 'users/users/editEquity',
add_url: 'users/users/add',
edit_url: 'users/users/edit',
del_url: 'users/users/del',
......@@ -31,6 +32,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{ checkbox: true },
{ field: 'id', title: __('Id') },
{ field: 'mobile', title: __('Mobile'), operate: 'LIKE' },
{ field: 'random_number', title: __('用户编号'), operate: 'LIKE' },
{ field: 'nickname', title: __('Nickname'), operate: 'LIKE' },
{ field: 'realname', title: __('Realname'), operate: 'LIKE' },
{ field: 'avatar', title: __('Avatar'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image },
......@@ -52,7 +54,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{ field: 'brand', title: __('Brand'), operate: false, visible: false},
{ field: 'equity', title: __('Equity'), operate: false,sortable:true},
{ field: 'equity_code', title: __('Equity_code'), operate: 'LIKE' },
{ field: 'signtime', title: __('Signtime')},
{ field: 'signtime', title: __('Signtime'),operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{ field: 'user_type', title: __('User_type'), searchList: { "wechat": __('User_type wechat'), "app": __('User_type app') }, formatter: Table.api.formatter.normal },
{ field: 'status', title: __('Status'),visible: false, searchList: { "1": __('Status 1'), "2": __('Status 2') }, formatter: Table.api.formatter.status},
{
......@@ -71,6 +73,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
classname: 'btn btn-xs btn-warning btn-dialog',
url: 'users/users/editShoppingMoney',
},
{
name: 'editequity',
text: __('股权'),
title: __('股权'),
classname: 'btn btn-xs btn-warning btn-dialog',
url: 'users/users/editEquity',
},
], events: Table.api.events.operate, formatter: Table.api.formatter.operate
}
]
......@@ -98,6 +107,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
});
Controller.api.bindevent();
},
editequity:function(){
$(".btn-dialog").data("success", function(){
parent.window.$(".btn-refresh").trigger("click");
});
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment