first commit
This commit is contained in:
@@ -0,0 +1 @@
|
||||
a1519cd4-363d-4c2a-87f6-0e9a0023bd99
|
||||
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Administrator
|
||||
* Date: 2020/4/24
|
||||
* Time: 15:06
|
||||
*/
|
||||
|
||||
namespace app\admin\model\costom;
|
||||
|
||||
|
||||
use think\Model;
|
||||
|
||||
class Message extends Model
|
||||
{
|
||||
protected $table = 'user_message';
|
||||
|
||||
/**
|
||||
* 获取留言建议列表信息
|
||||
* @param int $page 当前页
|
||||
* @param int $limit 每页显示数量
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @throws \think\exception\DbException
|
||||
*/
|
||||
public static function messageList($page = 1, $limit = 10, $search = []){
|
||||
$where = [];
|
||||
//搜索条件
|
||||
foreach ($search as $key => $value) {
|
||||
if (!empty($value)) {
|
||||
switch ($key) {
|
||||
case 'add_time':
|
||||
$value_list = explode(" - ", $value);
|
||||
$value_list[0] = strtotime($value_list[0]);
|
||||
$value_list[1] = strtotime($value_list[1]);
|
||||
$where[] = [$key, 'BETWEEN', ["$value_list[0]", "$value_list[1]"]];
|
||||
break;
|
||||
case 'status':
|
||||
$where[] = [$key, '=', $value];
|
||||
break;
|
||||
case 'telnum':
|
||||
$where[] = [$key, '=', $value];
|
||||
break;
|
||||
case 'type':
|
||||
$where[] = [$key, '=', $value-1];
|
||||
break;
|
||||
default:
|
||||
!empty($value) && $where[] = [$key, 'LIKE', '%' . $value . '%'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$count = self::where($where)->count();
|
||||
$data = self::where($where)->page($page, $limit)->order([ 'add_time' => 'desc'])->select();
|
||||
empty($data) ? $msg = '暂无数据!' : $msg = '查询成功!';
|
||||
|
||||
foreach ($data as $key => $val){
|
||||
$val['add_time'] = date('Y-m-d H:i:s',$val['add_time']);
|
||||
|
||||
if($val['reply_time']){
|
||||
$val['reply_time'] = date('Y-m-d H:i:s',$val['reply_time']);
|
||||
}
|
||||
$val['img1'] = config('secure.mpic_url'). $val['img1'];
|
||||
|
||||
$val['img2'] = config('secure.mpic_url'). $val['img2'];
|
||||
|
||||
|
||||
|
||||
if($val['type']){
|
||||
$val['type'] = config('setmes.mesName')[$val['type']];
|
||||
}else{
|
||||
$val['type'] = '考生建议';
|
||||
}
|
||||
}
|
||||
|
||||
$info = [
|
||||
'limit' => $limit,
|
||||
'page_current' => $page,
|
||||
'page_sum' => ceil($count / $limit),
|
||||
];
|
||||
$list = [
|
||||
'code' => 0,
|
||||
'msg' => $msg,
|
||||
'count' => $count,
|
||||
'info' => $info,
|
||||
'data' => $data,
|
||||
];
|
||||
return $list;
|
||||
}
|
||||
|
||||
/*
|
||||
* 回复问题
|
||||
* */
|
||||
public function reply($post){
|
||||
$post['reply'] = $post['replyCon'];
|
||||
$post['status'] = 2;
|
||||
unset($post['replyCon']);
|
||||
try {
|
||||
self::where('id', $post['id'])->update($post);
|
||||
} catch (\Exception $e) {
|
||||
|
||||
return __error($e->getMessage());
|
||||
}
|
||||
return __success('回复成功');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Administrator
|
||||
* Date: 2020/4/23
|
||||
* Time: 19:02
|
||||
*/
|
||||
|
||||
namespace app\admin\model\costom;
|
||||
|
||||
|
||||
use think\Exception;
|
||||
use think\facade\Log;
|
||||
use think\Model;
|
||||
|
||||
require '../extend/WxPay/WxPay.Api.php';
|
||||
class Order extends Model
|
||||
{
|
||||
protected $table = 'orders';
|
||||
|
||||
public static function orderRefund($post){
|
||||
$resOrder = self::field('ord_no,status,money')->where([['id','=',$post['id']],['status','=',1],['pay_way','=',$post['payWay']]])->find();
|
||||
//订单状态是否已支付
|
||||
if(!$resOrder){
|
||||
return 2;
|
||||
}
|
||||
if($post['payWay'] == 1){
|
||||
//退款参数赋值
|
||||
$data['order_no'] = $resOrder['ord_no'];
|
||||
$data['total_price'] = $resOrder['money'];
|
||||
$data['reason'] = $post['reason'];
|
||||
$data['op_user_id'] = config('wxpay.mch_id');
|
||||
$result = self::refund($data);
|
||||
|
||||
if($result['result_code'] == 'SUCCESS'){
|
||||
self::where([['id','=',$post['id']],['status','=',1]])->update(['status' => 2,'refund_time'=>time()]);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}else{
|
||||
$data['order_no'] = $resOrder['ord_no'];
|
||||
$data['total_price'] = $resOrder['money'];
|
||||
$data['reason'] = $post['reason'];
|
||||
$result = self::aliRefund($data);
|
||||
if($result->code == 10000 && $result->msg == 'Success'){
|
||||
self::where([['id','=',$post['id']],['status','=',1],['pay_way','=',$post['payWay']]])->update(['status' => 2,'refund_time'=>time()]);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 微信支付退款
|
||||
* @param $orderInfo
|
||||
* @throws \WxPayException
|
||||
*/
|
||||
private static function refund($orderInfo)
|
||||
{
|
||||
$inputObj = new \WxPayUnifiedOrder();
|
||||
$out_refund_no = date('Ymd') . str_pad(mt_rand(1, 99999), 5, '0', STR_PAD_LEFT);
|
||||
$inputObj->SetOut_trade_no($orderInfo['order_no']);
|
||||
$inputObj->SetOut_refund_no($out_refund_no);
|
||||
$inputObj->SetTotal_fee(intval($orderInfo['total_price']*100));
|
||||
$inputObj->SetRefund_fee(intval($orderInfo['total_price']*100));
|
||||
$inputObj->SetRefund_desc($orderInfo['reason']);
|
||||
$inputObj->SetOp_user_id( $orderInfo['op_user_id']);
|
||||
$wxOrder = \WxPayApi::refund($inputObj);
|
||||
return $wxOrder;
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付寶退款
|
||||
* @param $orderInfo
|
||||
*/
|
||||
private static function aliRefund($orderInfo)
|
||||
{
|
||||
require '../extend/alipay/wappay/buildermodel/AlipayTradeRefundContentBuilder.php';// 加载交易服务
|
||||
require '../extend/alipay/wappay/service/AlipayTradeService.php';// 加载交易服务
|
||||
|
||||
$out_trade_no = trim($orderInfo['order_no']);
|
||||
|
||||
//退款金额,不能大于订单总金额
|
||||
$refund_amount=trim($orderInfo['total_price']);
|
||||
|
||||
//退款的原因说明
|
||||
$refund_reason=trim($orderInfo['reason']);
|
||||
|
||||
$config = config('alipay.');
|
||||
|
||||
$RequestBuilder = new \AlipayTradeRefundContentBuilder();
|
||||
$RequestBuilder->setOutTradeNo($out_trade_no);
|
||||
$RequestBuilder->setRefundAmount($refund_amount);
|
||||
$RequestBuilder->setRefundReason($refund_reason);
|
||||
|
||||
|
||||
$Response = new \AlipayTradeService($config);
|
||||
$result=$Response->Refund($RequestBuilder);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取订单列表信息
|
||||
* @param int $page 当前页
|
||||
* @param int $limit 每页显示数量
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @throws \think\exception\DbException
|
||||
*/
|
||||
public function orderList($page = 1, $limit = 10, $search = []) {
|
||||
$where = [];
|
||||
//搜索条件
|
||||
foreach ($search as $key => $value) {
|
||||
if (!empty($value)) {
|
||||
switch ($key) {
|
||||
case 'add_time':
|
||||
$value_list = explode(" - ", $value);
|
||||
$value_list[0] = strtotime($value_list[0]);
|
||||
$value_list[1] = strtotime($value_list[1]);
|
||||
$where[] = [$key, 'BETWEEN', ["$value_list[0]", "$value_list[1]"]];
|
||||
break;
|
||||
case 'stu_yzy_province':
|
||||
$where[] = [$key, '=', $value];
|
||||
break;
|
||||
case 'telnum':
|
||||
$where[] = [$key, '=', $value];
|
||||
break;
|
||||
case 'ord_no':
|
||||
$where[] = [$key, '=', $value];
|
||||
break;
|
||||
case 'pay_way':
|
||||
$where[] = [$key, '=', $value];
|
||||
break;
|
||||
case 'status':
|
||||
if($value > 0){
|
||||
$where[] = [$key, '=', $value-1];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
!empty($value) && $where[] = [$key, 'LIKE', '%' . $value . '%'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$count = self::where($where)->count();
|
||||
$data = self::field('id,score,add_time,pay_time,vip,wenli,mykemustr,wenli,province_title,telnum,money,ord_no,refund_time,status,user_id,pay_way')->where($where)->page($page, $limit)->order([ 'add_time' => 'desc'])->select();
|
||||
empty($data) ? $msg = '暂无数据!' : $msg = '查询成功!';
|
||||
//获取配置权限名称
|
||||
$vipNameArr = config('product.vipName');
|
||||
|
||||
foreach ($data as $key => $val){
|
||||
$data[$key]['order_time'] = '';
|
||||
$data[$key]['vipName'] = $vipNameArr[$val['vip']];
|
||||
$data[$key]['order_time'] .= "下单:".date('Y-m-d H:i:s',$val['add_time']);
|
||||
if($val['pay_time']){
|
||||
$data[$key]['order_time'] .="_支付:". date('Y-m-d H:i:s',$val['pay_time']);
|
||||
}
|
||||
if($val['refund_time']){
|
||||
$data[$key]['order_time'] .="_退款:". date('Y-m-d H:i:s',$val['refund_time']);
|
||||
}
|
||||
$val['wenli'] = $val['wenli'] = config('setSub.subTypeName')[$val['wenli']];
|
||||
//拼接用户信息
|
||||
$data[$key]['userInfo'] = $val['province_title']."_".$val['score']."_".$val['wenli']."_".$val['mykemustr'];
|
||||
}
|
||||
|
||||
$info = [
|
||||
'limit' => $limit,
|
||||
'page_current' => $page,
|
||||
'page_sum' => ceil($count / $limit),
|
||||
];
|
||||
$list = [
|
||||
'code' => 0,
|
||||
'msg' => $msg,
|
||||
'count' => $count,
|
||||
'info' => $info,
|
||||
'data' => $data,
|
||||
];
|
||||
return $list;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Administrator
|
||||
* Date: 2020/4/25
|
||||
* Time: 15:11
|
||||
*/
|
||||
|
||||
namespace app\admin\model\costom;
|
||||
|
||||
|
||||
use app\admin\service\ModelService;
|
||||
|
||||
class Proscore extends ModelService
|
||||
{
|
||||
/**
|
||||
* 绑定数据表
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'yzy_province_lines2020';
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取省控分数列表
|
||||
* @param int $page
|
||||
* @param int $limit
|
||||
* @param array $search
|
||||
* @return array
|
||||
*/
|
||||
public static function getList($page = 1, $limit = 10, $search = []) {
|
||||
$where = [];
|
||||
//搜索条件
|
||||
foreach ($search as $key => $value) {
|
||||
if (!empty($value)) {
|
||||
switch ($key) {
|
||||
case 'province_id':
|
||||
$where[] = [$key, '=', $value];
|
||||
break;
|
||||
default:
|
||||
!empty($value) && $where[] = [$key, 'LIKE', '%' . $value . '%'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$count = self::where($where)->count();
|
||||
$data = self::where($where)->page($page, $limit)->select();
|
||||
empty($data) ? $msg = '暂无数据!' : $msg = '查询成功!';
|
||||
$info = [
|
||||
'limit' => $limit,
|
||||
'page_current' => $page,
|
||||
'page_sum' => ceil($count / $limit),
|
||||
];
|
||||
$list = [
|
||||
'code' => 0,
|
||||
'msg' => $msg,
|
||||
'count' => $count,
|
||||
'info' => $info,
|
||||
'data' => $data,
|
||||
];
|
||||
return $list;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Administrator
|
||||
* Date: 2020/4/23
|
||||
* Time: 8:57
|
||||
*/
|
||||
|
||||
namespace app\admin\model\costom;
|
||||
|
||||
|
||||
use app\admin\service\ModelService;
|
||||
|
||||
class User extends ModelService
|
||||
{
|
||||
protected $table = 'users';
|
||||
|
||||
/**
|
||||
* 获取用户列表信息
|
||||
* @param int $page 当前页
|
||||
* @param int $limit 每页显示数量
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @throws \think\exception\DbException
|
||||
*/
|
||||
public function userList($page = 1, $limit = 10, $search = []) {
|
||||
$where = [];
|
||||
//搜索条件
|
||||
foreach ($search as $key => $value) {
|
||||
if (!empty($value)) {
|
||||
switch ($key) {
|
||||
case 'add_time':
|
||||
$value_list = explode(" - ", $value);
|
||||
$value_list[0] = strtotime($value_list[0]);
|
||||
$value_list[1] = strtotime($value_list[1]);
|
||||
$where[] = [$key, 'BETWEEN', ["$value_list[0]", "$value_list[1]"]];
|
||||
break;
|
||||
case 'phone':
|
||||
$where[] = [$key, '=', $value];
|
||||
break;
|
||||
case 'province':
|
||||
$where[] = [$key, '=', $value];
|
||||
break;
|
||||
default:
|
||||
!empty($value) && $where[] = [$key, 'LIKE', '%' . $value . '%'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$count = self::where($where)->count();
|
||||
$data = self::field('id,score,add_time,province,phone,wenli,mykemu')->where($where)->page($page, $limit)->order([ 'add_time' => 'desc'])->select();
|
||||
empty($data) ? $msg = '暂无数据!' : $msg = '查询成功!';
|
||||
//获取省份数组
|
||||
$provinceArr = config('province.province');
|
||||
foreach ($data as $key => $val){
|
||||
$val['province'] = $provinceArr[$val['province']]['title'];
|
||||
$val['add_time'] = date('Y-m-d H:i:s',$val['add_time']);
|
||||
$val['wenli'] = config('setSub.subTypeName')[$val['wenli']];
|
||||
if($val['mykemu']){
|
||||
$val['mykemu'] = changeSubString($val['mykemu']);
|
||||
}
|
||||
|
||||
$data[$key]['userInfo'] = $val['province']."_".$val['score']."_".$val['wenli']."_".$val['mykemu'];
|
||||
}
|
||||
|
||||
|
||||
$info = [
|
||||
'limit' => $limit,
|
||||
'page_current' => $page,
|
||||
'page_sum' => ceil($count / $limit),
|
||||
];
|
||||
$list = [
|
||||
'code' => 0,
|
||||
'msg' => $msg,
|
||||
'count' => $count,
|
||||
'info' => $info,
|
||||
'data' => $data,
|
||||
];
|
||||
return $list;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user