Commit 2045bcba authored by wangtao's avatar wangtao

学习资料

parent 278ede97
......@@ -58,7 +58,7 @@ class Withdrawal extends AdminBase
$hasmap[] = ['username|mobile', 'like', '%' . $post['user'] . '%'];
}
$list = $this->withdrawal->where($map)->hasWhere('getuserdata', $hasmap)->with(['getuserdata'])->append(['sh_status_text', 'dk_status_text'])->order('createtime desc')->paginate($post['limit']);
$list = $this->withdrawal->where($map)->hasWhere('getuserdata', $hasmap)->with(['getuserdata' => ['smrzinfo']])->append(['sh_status_text', 'dk_status_text'])->order('createtime desc')->paginate($post['limit']);
return $this->returnMsg($list);
}
$this->assign('limit', $limit);
......@@ -105,7 +105,7 @@ class Withdrawal extends AdminBase
UserMoneyLog::addUserMoneyLog($txinfo['user_id'], $txinfo['tx_money'], $usermoney, 1, '审核驳回:' . $errordesc, $txinfo['id']);
//退回余额到用户
$res = User::where('id', $txinfo['user_id'])->setInc('money', $txinfo['tx_money']);
if(!$res){
if (!$res) {
Db::rollback();
throw new \Exception('余额变动失败');
}
......@@ -156,12 +156,12 @@ class Withdrawal extends AdminBase
UserMoneyLog::addUserMoneyLog($txinfo['user_id'], $txinfo['tx_money'], $usermoney, 1, '打款驳回:' . $errordesc, $txinfo['id']);
//退回余额到用户
$res = User::where('id', $txinfo['user_id'])->setInc('money', $txinfo['tx_money']);
if(!$res){
if (!$res) {
Db::rollback();
throw new \Exception('余额变动失败');
}
Mail::createmail($txinfo['user_id'], "您申请提现【" . $txinfo['sn']. "】打款失败 - " . $errordesc);
}else{
Mail::createmail($txinfo['user_id'], "您申请提现【" . $txinfo['sn'] . "】打款失败 - " . $errordesc);
} else {
Mail::createmail($txinfo['user_id'], "您申请提现:【" . $txinfo['sn'] . "】已通过打款请注意查收");
}
......@@ -201,18 +201,20 @@ class Withdrawal extends AdminBase
}
try {
$list = $this->withdrawal->where($map)->hasWhere('getuserdata', $hasmap)->with(['getuserdata'])->append(['sh_status_text', 'dk_status_text'])->order('createtime desc')->select()->toArray();
$list = $this->withdrawal->where($map)->hasWhere('getuserdata', $hasmap)->with(['getuserdata' => ['smrzinfo']])->append(['sh_status_text', 'dk_status_text'])->order('createtime desc')->select()->toArray();
if (empty($list)) {
throw new \Exception('没有数据');
}
$exceldata[] = ['提现单号', '用户名', '用户手机', '提现金额', '提现手续费', '实际到账金额', '提现账号', '审核状态', '打款状态', '提现时间', '打款时间'];
foreach ($list as $v) {
$exceldata[] = ['提现单号', '用户名', '用户手机', '真实姓名', '提现金额', '提现手续费', '实际到账金额', '提现账号', '审核状态', '打款状态', '提现时间', '打款时间'];
foreach ($list as $v) {
$realname = isset($v['getuserdata']['smrzinfo']['realname']) ? $v['getuserdata']['smrzinfo']['realname'] : '';
$exceldata[] = [
$v['sn'],
$v['getuserdata']['username'],
$v['getuserdata']['mobile'],
$realname,
$v['tx_money'],
$v['tx_commission'],
$v['tx_sj_money'],
......
......@@ -116,9 +116,10 @@
cols: [[
{type:'checkbox',fixed:'left'},
{field:'id',width:50,unresize:true,align:'center',title:'ID',sort:!0},
{field:'sn',align:'center',title:'提现单号'},
{field:'username',align:'center',title:'用户名',templet:'<div>{{= d.getuserdata.username}}</div>'},
{field:'mobile',align:'center',title:'用户手机',templet:'<div>{{= d.getuserdata.mobile}}</div>'},
{field:'sn',width:180,align:'center',title:'提现单号'},
{field:'username',align:'center',width:120,title:'用户名',templet:'<div>{{= d.getuserdata.username}}</div>'},
{field:'mobile',align:'center',width:120,title:'用户手机',templet:'<div>{{= d.getuserdata.mobile}}</div>'},
{field:'realname',align:'center',width:100,title:'真实姓名',templet:'<div>{{= d.getuserdata.smrzinfo.realname}}</div>'},
{field:'tx_money',align:'center',width:100,title:'提现金额'},
{field:'tx_commission',align:'center',width:100,title:'提现手续费'},
{field:'tx_sj_money',align:'center',width:100,title:'实际到账金额'},
......
......@@ -62,20 +62,20 @@ class Cert extends BaseController
$list = (new CertOrder())->latestCertList($page,$pageSize)->toArray();
$dd = $list['data'][0];
$list['data'][] = $dd;
$list['data'][] = $dd;
$list['data'][] = $dd;
$list['data'][] = $dd;
$list['data'][] = $dd;
$list['data'][] = $dd;
$list['data'][] = $dd;
$list['data'][] = $dd;
$list['data'][] = $dd;
$list['data'][] = $dd;
$list['data'][] = $dd;
$list['data'][] = $dd;
// $dd = $list['data'][0];
//
// $list['data'][] = $dd;
// $list['data'][] = $dd;
// $list['data'][] = $dd;
// $list['data'][] = $dd;
// $list['data'][] = $dd;
// $list['data'][] = $dd;
// $list['data'][] = $dd;
// $list['data'][] = $dd;
// $list['data'][] = $dd;
// $list['data'][] = $dd;
// $list['data'][] = $dd;
// $list['data'][] = $dd;
return $this->returnMsg('success',1,$list);
}
......
......@@ -8,6 +8,7 @@ use app\api\validate\ShCourseValidate;
use app\BaseController;
use app\model\CertTag;
use app\model\CourseCategory;
use app\model\Payment;
use app\model\ShCourse as ShCourseModel;
use app\Request;
use think\facade\Db;
......@@ -77,11 +78,16 @@ class ShCourse extends BaseController
}
$parm = $request->param();
$where = ['id' => $parm['course_id'], 'user_id' => $request->userId];
if($parm['updateField'] == 'is_sell'){
if ($parm['updateField'] == 'is_sell') {
$status = ShCourseModel::where($where)->value('status');
if($status != 3){
if ($status != 3) {
return $this->returnMsg('审核未通过不能上下架');
}
$ordercunt = Payment::where('order_id', $parm['course_id'])->where(['pay_status' => 1, 'order_type' => 1])->count();
if ($ordercunt > 0 && $parm['updateValue'] == '0') {
return $this->returnMsg('课程已售出不能下架');
}
}
$result = ShCourseModel::where($where)->update([$parm['updateField'] => $parm['updateValue']]);
event('Course', ['course_id' => $parm['course_id'], 'tasktype' => 'course', 'action' => 'shcourseupdate']); //同步数据
......@@ -119,7 +125,7 @@ class ShCourse extends BaseController
//添加课程
public function createShCourse(Request $request)
{
$filed = ['title', 'cate_id', 'thumb', 'teacher_id', 'detailthumb', 'content','tag_ids','teacher_id','price','description','is_zb'];
$filed = ['title', 'cate_id', 'thumb', 'teacher_id', 'detailthumb', 'content', 'tag_ids', 'teacher_id', 'price', 'description', 'is_zb'];
$vo = (new ShCourseValidate())->goCheck($filed);
if ($vo !== true) {
return $vo;
......@@ -135,7 +141,7 @@ class ShCourse extends BaseController
//修改课程
public function editShCourse(Request $request)
{
$filed = ['course_id', 'title', 'cate_id', 'thumb', 'teacher_id', 'detailthumb', 'content','tag_ids','teacher_id','price','description','is_zb'];
$filed = ['course_id', 'title', 'cate_id', 'thumb', 'teacher_id', 'detailthumb', 'content', 'tag_ids', 'teacher_id', 'price', 'description', 'is_zb'];
$vo = (new ShCourseValidate())->goCheck($filed);
if ($vo !== true) {
return $vo;
......@@ -159,7 +165,7 @@ class ShCourse extends BaseController
return $vo;
}
$parm = $request->param();
$info = ShCourseModel::find($parm['course_id'])->append(['thumbpath','detailthumbpath', 'cate_name', 'teacher_name', 'status_text']);
$info = ShCourseModel::find($parm['course_id'])->append(['thumbpath', 'detailthumbpath', 'cate_name', 'teacher_name', 'status_text']);
$info = UtilService::infoWithTags($info, (\app\model\CourseTag::class), 'tag_ids');
return $this->returnMsg('操作成功', 1, $info);
......
......@@ -128,9 +128,9 @@ class User extends BaseController
return $vo;
}
if (UserAccount::where(['user_id' => $request->userId, 'is_del' => 0])->count()) {
return $this->returnMsg('请勿重复提交');
}
// if (UserAccount::where(['user_id' => $request->userId, 'is_del' => 0])->count()) {
// return $this->returnMsg('请勿重复提交');
// }
$data = $request->param();
......@@ -155,9 +155,12 @@ class User extends BaseController
$data = $request->param();
//check sms
$checkSmsCode = UtilService::checkSmsCode($data['mobile'], $data['code']);
if (!$checkSmsCode) {
return $this->returnMsg('验证码错误');
}
$res = UserService::updateUserInfo('mobile', $data['mobile']);
return $this->returnMsg('操作成功', 1, $res);
}
......
......@@ -101,7 +101,7 @@ class CertOrder extends Model
public function getUpdatetimeTextAttr($value, $data)
{
$timestamp = is_numeric($data['updatetime']) ? $data['updatetime'] : strtotime($data['createtime']);
$timestamp = is_numeric($data['updatetime']) ? $data['updatetime'] : $data['createtime'];
return $this->timeElapsedString($timestamp);
}
......@@ -113,13 +113,13 @@ class CertOrder extends Model
if ($timeDiff < 60) {
return '刚刚';
} elseif ($timeDiff < 3600) {
return floor($timeDiff / 60) . '分前';
return floor($timeDiff / 60) . '分前';
} elseif ($timeDiff < 86400) {
return floor($timeDiff / 3600) . '时前';
return floor($timeDiff / 3600) . '时前';
} elseif ($timeDiff < 2592000) {
return floor($timeDiff / 86400) . '天前';
} elseif ($timeDiff < 31536000) {
return floor($timeDiff / 2592000) . '月前';
return floor($timeDiff / 2592000) . '月前';
} else {
return floor($timeDiff / 31536000) . '年前';
}
......
......@@ -2,6 +2,7 @@
namespace app\model\project;
use app\admin\controller\users\Smrz;
use app\model\Payment;
use app\model\system\SystemUploadFile;
use think\Model;
......@@ -41,6 +42,13 @@ class User extends Model
->field('account,id,user_id,is_del');
}
//实名认证
public function smrzinfo()
{
return $this->hasOne(UserSmrz::class, 'user_id', 'id')
->where('is_del',0)
->field('id,realname,user_id,idcard');
}
//获取头像
public function getHeadericourlAttr($value, $data)
{
......
......@@ -251,7 +251,7 @@ class SendSms
// 存储验证码,有效期与发送间隔相同
$verificationKey = self::TOKEN_PREFIX . $mobile;
Cache::set($verificationKey, $code, $lent);
Cache::set($verificationKey, $code, 600);
// 记录日志
$message = '您的验证码为:' . $code . ',请勿泄露于他人!';
......
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