拉卡拉支付。手机号增加
This commit is contained in:
parent
47f0ba1119
commit
a80570a44c
@ -428,6 +428,35 @@ class Activity extends Backend
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 微信短链接
|
||||
* @return string
|
||||
* @throws \think\Exception
|
||||
* @throws \think\db\exception\BindParamException
|
||||
* @throws \think\exception\DbException
|
||||
* @throws \think\exception\PDOException
|
||||
*/
|
||||
public function miniurl($ids = ''){
|
||||
$param = $this->request->param();
|
||||
if($this->request->isPost()){
|
||||
try{
|
||||
if(isset($param['ids']))$ids = $param['ids'];
|
||||
//设置模拟资格
|
||||
$url = \app\common\model\school\activity\Activity::getMiniQrcodeLink($ids);
|
||||
|
||||
}catch (\Exception $e){
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
$this->success($url["url_link"]);
|
||||
}
|
||||
$row = $this->model->get($ids);
|
||||
$this->view->assign('vo', $row);
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 微信小程序码
|
||||
* @return string
|
||||
|
@ -24,8 +24,8 @@
|
||||
<div class="input-group">
|
||||
<input id="c-images" data-rule="required" class="form-control" size="50" name="row[images]" type="text">
|
||||
<div class="input-group-addon no-border no-padding">
|
||||
<span><button type="button" id="faupload-images" class="btn btn-danger faupload" data-input-id="c-images" data-maxcount="5" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
|
||||
<span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-input-id="c-images" data-maxcount="5" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
|
||||
<span><button type="button" id="faupload-images" class="btn btn-danger faupload" data-input-id="c-images" data-maxcount="9" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
|
||||
<span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-input-id="c-images" data-maxcount="9" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
|
||||
</div>
|
||||
<span class="msg-box n-right" for="c-images"></span>
|
||||
</div>
|
||||
|
@ -27,8 +27,8 @@
|
||||
<div class="input-group">
|
||||
<input id="c-images" data-rule="required" class="form-control" size="50" name="row[images]" type="text" value="{$row.images|htmlentities}">
|
||||
<div class="input-group-addon no-border no-padding">
|
||||
<span><button type="button" id="faupload-images" class="btn btn-danger faupload" data-maxcount="5" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
|
||||
<span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-maxcount="5" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
|
||||
<span><button type="button" id="faupload-images" class="btn btn-danger faupload" data-maxcount="9" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
|
||||
<span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-maxcount="9" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
|
||||
</div>
|
||||
<span class="msg-box n-right" for="c-images"></span>
|
||||
</div>
|
||||
|
@ -27,8 +27,8 @@
|
||||
<div class="input-group">
|
||||
<input id="c-images" data-rule="required" class="form-control" size="50" name="row[images]" type="text" value="{$row.images|htmlentities}">
|
||||
<div class="input-group-addon no-border no-padding">
|
||||
<span><button type="button" id="faupload-images" class="btn btn-danger faupload" data-maxcount="5" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
|
||||
<span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-maxcount="5" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
|
||||
<span><button type="button" id="faupload-images" class="btn btn-danger faupload" data-maxcount="9" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
|
||||
<span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-maxcount="9" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
|
||||
</div>
|
||||
<span class="msg-box n-right" for="c-images"></span>
|
||||
</div>
|
||||
|
@ -5,6 +5,7 @@ namespace app\api\controller\school;
|
||||
|
||||
use app\common\model\school\activity\Activity;
|
||||
use app\common\model\school\activity\Cate;
|
||||
use app\common\model\school\activity\order\OrderCode;
|
||||
use app\common\model\school\activity\order\SettleLog;
|
||||
use app\common\model\school\activity\Refund;
|
||||
|
||||
@ -13,7 +14,7 @@ use app\common\model\school\activity\Refund;
|
||||
*/
|
||||
class NewActivity extends Base
|
||||
{
|
||||
protected $noNeedLogin = ['cate_list',"activity_list","detail","refund_list","add"];
|
||||
protected $noNeedLogin = ['cate_list',"activity_list","detail","refund_list","add","people_list"];
|
||||
protected $noNeedRight = '*';
|
||||
|
||||
protected $model = null;
|
||||
@ -562,5 +563,60 @@ class NewActivity extends Base
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @ApiTitle( 活动参与人列表)
|
||||
* @ApiSummary(活动参与人列表)
|
||||
* @ApiMethod(GET)
|
||||
* @ApiParams(name = "keywords", type = "string",required=false,description = "搜索关键字")
|
||||
* @ApiParams(name = "my", type = "string",required=true,description = "是否查自己(需登录) 1是 0否")
|
||||
* @ApiParams(name = "page", type = "string",required=true,description = "页数")
|
||||
* @ApiParams(name = "limit", type = "string",required=true,description = "条数")
|
||||
* @ApiParams(name = "code_status", type = "int",required=false,description = "核销状态:3=未核销,6=已核销")
|
||||
* @ApiParams(name = "activity_id", type = "string",required=false,description = "活动id 多值逗号拼接")
|
||||
* @ApiParams(name = "status", type = "string",required=false,description = "订单状态:-3=已取消,0=待支付,2=已报名,3=核销中,4=售后中,5=退款结算中,6=已退款,7=售后挂起,9=已完成,不传查所有,可按多值逗号拼接")
|
||||
* @ApiParams(name = "order", type = "string",required=false,description = " normal=综合排序,earliest=早优先,new=最新优先,recently=最近优先")
|
||||
* @ApiReturn({
|
||||
*
|
||||
*})
|
||||
*/
|
||||
public function people_list()
|
||||
{
|
||||
$user_id = 0;
|
||||
$user = $this->auth->getUser();//登录用户
|
||||
if($user)$user_id = $user['id'];
|
||||
$params =[];
|
||||
|
||||
|
||||
$params["my"] = $this->request->get('my/d', 0); //机构店铺id
|
||||
$params["my_user_id"] = $user_id;
|
||||
$params["page"] = $this->request->get('page/d', 1); //页数
|
||||
$params["limit"] = $this->request->get('limit/d', 10); //条数
|
||||
$params["keywords"] = $this->request->get('keywords/s', ''); //搜索关键字
|
||||
$params["activity_id"] = $this->request->get('activity_id/d', ''); //机构店铺id
|
||||
$params["code_status"] = $this->request->get('code_status/s', ''); //机构店铺id
|
||||
$params["status"] = $this->request->get('status/s', ''); //机构店铺id
|
||||
$params["order"] = $this->request->get('order/s', 'normal'); //机构店铺id
|
||||
|
||||
|
||||
// $type = $this->request->get('type/s', ''); //筛选学员和教练单
|
||||
|
||||
try{
|
||||
//当前申请状态
|
||||
$res = OrderCode::getVaildList($params);
|
||||
$count = OrderCode::getVaildList($params,true);
|
||||
// if($user_id =='670153'){
|
||||
// file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
|
||||
// }
|
||||
}catch (\Exception $e){
|
||||
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
$this->success('查询成功', ["list"=>$res,"count"=>$count]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -135,6 +135,8 @@ class ActivityJoin extends Base
|
||||
* @ApiMethod(POST)
|
||||
* @ApiParams(name = "name", type = "int",required=true,description = "姓名")
|
||||
* @ApiParams(name = "idnum", type = "string",required=true,description = "身份证号")
|
||||
* @ApiParams(name = "mobile", type = "string",required=true,description = "手机号")
|
||||
* @ApiParams(name = "open", type = "string",required=true,description = "是否公开:0=否,1=是")
|
||||
* @ApiReturn({
|
||||
*
|
||||
*})
|
||||
@ -151,6 +153,9 @@ class ActivityJoin extends Base
|
||||
$params["user_id"] = $user_id; //老师id
|
||||
$params["name"] = $this->request->post('name/s', ''); //课程标签
|
||||
$params["idnum"] = $this->request->post('idnum/s', ''); //课程标签
|
||||
$params["mobile"] = $this->request->post('mobile/s', ''); //课程标签
|
||||
$params["open"] = $this->request->post('open/s', '1'); //课程标签
|
||||
|
||||
|
||||
try{
|
||||
$res = $this->model->add($params,true);
|
||||
@ -170,6 +175,8 @@ class ActivityJoin extends Base
|
||||
* @ApiParams (name="ids", type="string", required=true, description="需要编辑的id")
|
||||
* @ApiParams(name = "name", type = "int",required=true,description = "姓名")
|
||||
* @ApiParams(name = "idnum", type = "string",required=true,description = "身份证号")
|
||||
* @ApiParams(name = "mobile", type = "string",required=true,description = "手机号")
|
||||
* @ApiParams(name = "open", type = "string",required=true,description = "是否公开:0=否,1=是")
|
||||
* @ApiReturn({
|
||||
*
|
||||
*})
|
||||
@ -185,7 +192,8 @@ class ActivityJoin extends Base
|
||||
$params["user_id"] = $user_id; //老师id
|
||||
$params["name"] = $this->request->post('name/s', ''); //课程标签
|
||||
$params["idnum"] = $this->request->post('idnum/s', ''); //课程标签
|
||||
|
||||
$params["mobile"] = $this->request->post('mobile/s', ''); //课程标签
|
||||
$params["open"] = $this->request->post('open/s', '1'); //课程标签
|
||||
try{
|
||||
$res = $this->model->edit($ids,$params,true);
|
||||
}catch (\Throwable $e){
|
||||
|
@ -79,9 +79,31 @@ class Pay extends Base
|
||||
$this->error("支付金额必须大于0");
|
||||
}
|
||||
|
||||
if (!$type || !in_array($type, ['alipay', 'wechat'])) {
|
||||
if (!$type || !in_array($type, ['alipay', 'wechat',"lakala"])) {
|
||||
$this->error("支付类型不能为空");
|
||||
}
|
||||
//订单号
|
||||
$out_trade_no = $order_no;
|
||||
|
||||
//订单标题
|
||||
$title = '活动订单['.$out_trade_no."]支付";
|
||||
|
||||
if($lakala){
|
||||
|
||||
if (!$method || !in_array($method, ['miniapp'])) {
|
||||
$this->error("目前仅支持小程序发起拉卡拉支付!");
|
||||
}
|
||||
|
||||
try {
|
||||
$lakala_params = OrderModel::getLakalaOrderPayParams($order_no,"wechat",$openid);
|
||||
}catch (\Exception $e){
|
||||
$this->error($e->getMessage(),["error_code"=> $e->getCode()]);
|
||||
}
|
||||
$this->success('获取成功!', $lakala_params);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (in_array($method, ['miniapp', 'mp']) && !$openid) {
|
||||
|
||||
@ -105,11 +127,7 @@ class Pay extends Base
|
||||
}
|
||||
}
|
||||
|
||||
//订单号
|
||||
$out_trade_no = $order_no;
|
||||
|
||||
//订单标题
|
||||
$title = '活动订单['.$out_trade_no."]支付";
|
||||
|
||||
//回调链接
|
||||
$notifyurl = $this->request->root(true) . '/api/school.newactivity.pay/notifyx/paytype/' . $type. '/platform/' . $method;
|
||||
@ -134,6 +152,65 @@ class Pay extends Base
|
||||
{
|
||||
$paytype = $this->request->param('paytype');
|
||||
$platform = $this->request->param('platform');
|
||||
|
||||
|
||||
//如果是拉卡拉则走拉卡拉的支付回调逻辑
|
||||
if ($paytype == 'lakala') {
|
||||
$lakala = lakala_sdk();
|
||||
$api = $lakala->v3(\Lakala\OpenAPISDK\V3\Api\LakalaNotifyApi::class);
|
||||
try {
|
||||
# 接收通知请求
|
||||
$request = $api->notiApi();
|
||||
# 通知请求头信息
|
||||
$headers = $request->getHeaders();
|
||||
# 通知请求原文
|
||||
$originalText = $request->getOriginalText();
|
||||
|
||||
$data = json_decode($originalText, true);
|
||||
|
||||
// 处理$obj中交易状态 -> 可能多次调用
|
||||
$out_trade_no = $data['out_trade_no'];
|
||||
|
||||
// 支付成功流程
|
||||
//获取支付金额、订单号
|
||||
$pay_fee = bcdiv($data['payer_amount'], 100, 2);
|
||||
|
||||
//你可以在此编写订单逻辑
|
||||
$order = OrderModel::getNopayOrder($out_trade_no);
|
||||
|
||||
if (!$order || $order["status"] != '0') {
|
||||
// 订单不存在,或者订单已支付
|
||||
$api->success();
|
||||
return null;
|
||||
}
|
||||
$notify = [
|
||||
'order_no' => $data['out_trade_no'],
|
||||
'transaction_id' => $data['trade_no'],
|
||||
'notify_time' => date('Y-m-d H:i:s', strtotime($data['time_end'])),
|
||||
'buyer_email' => $data['user_id1'] ?? $data['user_id2'] ?? "",
|
||||
'payment_json' => json_encode($data),
|
||||
'pay_fee' => $pay_fee,
|
||||
'pay_type' => $paytype, // 支付方式
|
||||
'platform' => $platform,
|
||||
];
|
||||
|
||||
$this->model->paySuccess($order['order_no'],$notify,$pay_fee,true,true);
|
||||
|
||||
|
||||
// 通知拉卡拉业,务处理成功
|
||||
$api->success();
|
||||
} catch (\Exception $e) {
|
||||
// echo $e->getMessage();
|
||||
// 通知拉卡拉,发生异常
|
||||
$api->fail($e->getMessage());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$pay = Service::checkNotify($paytype);
|
||||
if (!$pay) {
|
||||
return json(['code' => 'FAIL', 'message' => '失败'], 500, ['Content-Type' => 'application/json']);
|
||||
|
@ -65,26 +65,25 @@ class Join extends BaseModel
|
||||
throw new \Exception(__('Parameter %s can not be empty', ''));
|
||||
}
|
||||
|
||||
|
||||
if(config("site.activity_idcard_need")){
|
||||
$rule = [
|
||||
'user_id'=>'require',
|
||||
'name'=>'require',
|
||||
'idnum'=>'require',
|
||||
];
|
||||
}else{
|
||||
$rule = [
|
||||
'user_id'=>'require',
|
||||
'name'=>'require',
|
||||
$rule = [
|
||||
'user_id'=>'require',
|
||||
'name'=>'require',
|
||||
// 'idnum'=>'require',
|
||||
];
|
||||
];
|
||||
if(config("site.activity_idcard_need")){
|
||||
$rule[ 'idnum'] = 'require';
|
||||
}
|
||||
|
||||
if(config("site.activity_idcard_need")){
|
||||
$rule[ 'mobile'] = 'require';
|
||||
}
|
||||
|
||||
|
||||
$rule_msg = [
|
||||
"user_id.require"=>'用户必填',
|
||||
"name.require"=>'姓名必填',
|
||||
"idnum.require"=>'身份证号必填',
|
||||
"mobile.require"=>'手机号必填',
|
||||
];
|
||||
|
||||
self::check($params,$rule,$rule_msg);
|
||||
@ -138,24 +137,25 @@ class Join extends BaseModel
|
||||
|
||||
|
||||
|
||||
if(config("site.activity_idcard_need")){
|
||||
$rule = [
|
||||
'user_id'=>'require',
|
||||
'name'=>'require',
|
||||
'idnum'=>'require',
|
||||
];
|
||||
}else{
|
||||
$rule = [
|
||||
'user_id'=>'require',
|
||||
'name'=>'require',
|
||||
$rule = [
|
||||
'user_id'=>'require',
|
||||
'name'=>'require',
|
||||
// 'idnum'=>'require',
|
||||
];
|
||||
];
|
||||
if(config("site.activity_idcard_need")){
|
||||
$rule[ 'idnum'] = 'require';
|
||||
}
|
||||
|
||||
if(config("site.activity_idcard_need")){
|
||||
$rule[ 'mobile'] = 'require';
|
||||
}
|
||||
|
||||
|
||||
$rule_msg = [
|
||||
"user_id.require"=>'用户必填',
|
||||
"name.require"=>'姓名必填',
|
||||
"idnum.require"=>'身份证号必填',
|
||||
"mobile.require"=>'手机号必填',
|
||||
];
|
||||
|
||||
self::check($params,$rule,$rule_msg);
|
||||
|
@ -965,6 +965,8 @@ class Order extends BaseModel
|
||||
if($people && isset($people[$i])){
|
||||
$params["name"] = $people[$i]["name"];
|
||||
$params["idnum"] = $people[$i]["idnum"] ?? "";
|
||||
$params["mobile"] = $people[$i]["mobile"] ?? "";
|
||||
$params["open"] = $people[$i]["open"] ?? "1";
|
||||
}
|
||||
|
||||
|
||||
@ -2743,9 +2745,9 @@ class Order extends BaseModel
|
||||
$order = self::getOrder($order_no);
|
||||
$detail = $order->detail;
|
||||
if(!$detail)throw new \Exception("找不到活动!");
|
||||
$lakalaBusiness = LakalaBusiness::where("user_id",$detail["user_id"]);
|
||||
$lakala = $lakalaBusiness->where("status",config("site.lakala_test_switch")? '2':'1' )->find();
|
||||
if(!$lakala)throw new \Exception("商户未开通拉卡拉钱包不具备收款能力!");
|
||||
$lakalaBusinessModel = LakalaBusiness::where("user_id",$detail["user_id"]);
|
||||
$lakalaBusiness = $lakalaBusinessModel->where("status",config("site.lakala_test_switch")? '2':'1' )->find();
|
||||
if(!$lakalaBusiness)throw new \Exception("商户未开通拉卡拉钱包不具备收款能力!");
|
||||
|
||||
//金额需大于0
|
||||
if($order["totalprice"] <= 0)throw new \Exception("金额需大于0!");
|
||||
@ -2764,8 +2766,8 @@ class Order extends BaseModel
|
||||
|
||||
|
||||
// 必填参数
|
||||
$request->setMerchantNo($lakala["merchant_no"]);
|
||||
$request->setTermNo($lakala["online_scanning_terminal_no"]);
|
||||
$request->setMerchantNo($lakalaBusiness["merchant_no"]);
|
||||
$request->setTermNo($lakalaBusiness["online_scanning_terminal_no"]);
|
||||
$request->setOutTradeNo($order["order_no"]);
|
||||
$request->setAccountType('WECHAT');
|
||||
$request->setTransType('71');
|
||||
@ -2833,25 +2835,28 @@ class Order extends BaseModel
|
||||
|
||||
// try {
|
||||
$response = $api->transPreorder($request);
|
||||
if ($response->getRespData()) {
|
||||
print_r($response->getRespData());
|
||||
print_r($response->getAccRespFields());
|
||||
}
|
||||
else {
|
||||
print_r($response);
|
||||
}
|
||||
echo $response->getCode();
|
||||
// if ($response->getRespData()) {
|
||||
// print_r($response->getRespData());
|
||||
// print_r($response->getAccRespFields());
|
||||
// }
|
||||
// else {
|
||||
// print_r($response);
|
||||
// }
|
||||
// echo $response->getCode();
|
||||
//
|
||||
// # 响应头信息
|
||||
// print_r($response->getHeaders());
|
||||
|
||||
# 响应头信息
|
||||
print_r($response->getHeaders());
|
||||
|
||||
# 响应原文
|
||||
echo $response->getOriginalText();
|
||||
$bbs_code = $response->getCode();
|
||||
$responsedata = json_decode($response->getOriginalText(),true);
|
||||
if($bbs_code != "BBS00000"){
|
||||
throw new \Exception($responsedata["msg"],$responsedata["code"]);
|
||||
}
|
||||
// } catch (\Lakala\OpenAPISDK\V3\ApiException $e) {
|
||||
// echo $e->getMessage();
|
||||
// }
|
||||
|
||||
return $response->getOriginalText();
|
||||
return $responsedata;
|
||||
|
||||
}
|
||||
|
||||
|
@ -107,6 +107,8 @@ class OrderCode extends BaseModel
|
||||
*/
|
||||
public static function updateVerification($code,$oper_id = 0,$oper_type='user',$check=true){
|
||||
if(is_string($code))$code = self::getHaveVerificationOrderCode($code,$check);
|
||||
// if($code["status"] == "6")return $code;
|
||||
|
||||
$code->status = "6";//refund_status
|
||||
$code->verification_user_id = $oper_id;
|
||||
$code->verification_type = $oper_type;
|
||||
@ -128,7 +130,8 @@ class OrderCode extends BaseModel
|
||||
*/
|
||||
public static function getHaveVerificationOrderCode($code,$check=true){
|
||||
// $where = [self::STATUS_NOPAY,self::STATUS_PAYED];
|
||||
$ordercode = self::where('code',$code)->where("status","in",['3'])->find();
|
||||
// $ordercode = self::where('code',$code)->where("status","in",['3'])->find();
|
||||
$ordercode = self::where('code',$code)->find();
|
||||
if(!$ordercode)throw new \Exception("当前码已存在或核销过!");
|
||||
$order = $ordercode->activityorder;
|
||||
if(!$order)throw new \Exception("订单异常!");
|
||||
@ -155,8 +158,11 @@ class OrderCode extends BaseModel
|
||||
*/
|
||||
public function forceVerification($code,$oper_type='user',$oper_id=0,$check=true)
|
||||
{
|
||||
if(is_string($code))$code = self::getHaveVerificationOrderCode($code,$check);
|
||||
if($code["status"] == "6")return $code;
|
||||
|
||||
$ordercode = self::updateVerification($code,$oper_id,$oper_type,$check);
|
||||
|
||||
$order = $ordercode->activityorder;
|
||||
if($check){
|
||||
|
||||
@ -194,6 +200,10 @@ class OrderCode extends BaseModel
|
||||
public function verification($code,$user_id=0,$check=false,$oper_type='user',$oper_id=0,$trans=false){
|
||||
//得到可取消订单
|
||||
$ordercode = self::getHaveVerificationOrderCode($code,$check);
|
||||
|
||||
if($ordercode["status"] == "6")return $ordercode;
|
||||
|
||||
|
||||
$order = $ordercode->activityorder;
|
||||
if(!$order) throw new \Exception("订单异常!");
|
||||
$detail = $order->detail;
|
||||
@ -236,5 +246,203 @@ class OrderCode extends BaseModel
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取所有报名人列表
|
||||
*/
|
||||
public static function getVaildList($params,$count=false) {
|
||||
extract($params);
|
||||
// $a = '';
|
||||
$a = (new self)->getWithAlisaName().'.';
|
||||
$with = ['user'];
|
||||
// if (isset($has_shop) && $has_shop) {
|
||||
$with[] = 'activityorder';
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// $cate_list = Cate::where("status",'1')->column("name","id");
|
||||
// $label_list = Label::where("status",'1')->column("name","id");
|
||||
// $type_list = Type::where("status",'1')->column("name","id");
|
||||
$selfetch = self::with($with);
|
||||
|
||||
// $selfetch = self::where("{$a}show", '=', '1');
|
||||
|
||||
$order = $order?? 'normal';
|
||||
$per_page = $limit ?? 10;
|
||||
|
||||
|
||||
// $field = "{$a}id,{$a}title,{$a}image,{$a}status,{$a}video_file,{$a}recommend,{$a}show,{$a}weigh,{$a}views,{$a}collect,{$a}release_time,{$a}createtime,{$a}updatetime,{$a}deletetime";
|
||||
//
|
||||
// //得到距离
|
||||
// if (isset($latitude) && isset($longitude) && $latitude && $longitude) {
|
||||
// $field .= ', '.getDistanceBuilder($latitude, $longitude,$a);
|
||||
// }else{
|
||||
// $field .= ', 0 as distance';
|
||||
// }
|
||||
|
||||
//得到每个
|
||||
|
||||
|
||||
// $selfetch = $selfetch->field($field);
|
||||
if (isset($keywords) && $keywords) {
|
||||
// //查询分类名获得分类id
|
||||
// $keywords_cate_ids = Cate::where("name",'like', '%' . $keywords . '%')->column("id");
|
||||
//
|
||||
// if($keywords_cate_ids){
|
||||
// $keywords_cate_ids = implode("|",$keywords_cate_ids);
|
||||
// $selfetch = $selfetch->where(function ($query)use($a,$keywords_cate_ids,$keywords){
|
||||
// $query->whereRaw(" {$a}cate_ids REGEXP '({$keywords_cate_ids})'")
|
||||
// ->whereOr("{$a}title|{$a}platform_title|{$a}content|{$a}address|{$a}address_detail|{$a}address_city", 'like', '%' . $keywords . '%');
|
||||
// });
|
||||
//
|
||||
//// $selfetch = $selfetch->whereOr( function ($query)use($a,$keywords_cate_ids){
|
||||
//// $query->whereRaw(" {$a}cate_ids REGEXP '({$keywords_cate_ids})'")
|
||||
//// ->where("{$a}show", '=', '1');
|
||||
//// });
|
||||
// }else{
|
||||
$selfetch = $selfetch->where("{$a}name|{$a}idnum|{$a}mobile", 'like', '%' . $keywords . '%');
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (isset($user_id) && $user_id) {
|
||||
$selfetch = $selfetch->where("{$a}user_id", 'in', ''.$user_id);
|
||||
}
|
||||
|
||||
if (isset($my) && $my && isset($my_user_id) && $my_user_id) {
|
||||
$selfetch = $selfetch->where("{$a}user_id", 'in', ''.$my_user_id);
|
||||
}
|
||||
if($my ==1 && empty($my_user_id)){
|
||||
$selfetch = $selfetch->where("{$a}user_id", 'in', [-3]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (isset($activity_id) && $activity_id) {
|
||||
$selfetch = $selfetch->where("{$a}activity_id", 'in', ''.$activity_id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//设置订单信息
|
||||
if(isset($status) && $status !=='' && $status !==null){
|
||||
$selfetch = $selfetch->where("activityorder.status", 'in', ''.$status);
|
||||
}
|
||||
|
||||
|
||||
if(isset($code_status) && $code_status !=='' && $code_status !==null){
|
||||
$selfetch = $selfetch->where("{$a}status", 'in', ''.$code_status);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// $collect_classes_lib_ids = [-1];
|
||||
// //需登录查询条件:
|
||||
// if(isset($my_user_id) && $my_user_id){
|
||||
// //得到我收藏的课程ids
|
||||
// $collect_classes_lib_ids = Collect::where("user_id",$my_user_id)->column("meal_classes_id");
|
||||
// //专查我的收藏
|
||||
// if(isset($collect) && $collect){
|
||||
// $selfetch = $selfetch->where("{$a}id","in",$collect_classes_lib_ids);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
//排序
|
||||
switch ($order) {
|
||||
case "normal": //综合排序(推薦優先)
|
||||
$selfetch = $selfetch->order("{$a}id desc");
|
||||
break;
|
||||
// case "distance": //距离优先 权重
|
||||
// $selfetch = $selfetch->order("distance asc,{$a}recommend desc,{$a}weigh desc,{$a}id desc");
|
||||
// break;
|
||||
|
||||
// case "recommend": //推薦优先
|
||||
// $selfetch = $selfetch->order("{$a}recommend desc,{$a}weigh desc,{$a}id desc");
|
||||
// break;
|
||||
|
||||
case "earliest": //浏览量优先
|
||||
$selfetch = $selfetch->order("{$a}id asc");
|
||||
break;
|
||||
case "new": //收藏量优先
|
||||
$selfetch = $selfetch->order("{$a}id desc");
|
||||
break;
|
||||
case "recently": //收藏量优先
|
||||
$selfetch = $selfetch->order("{$a}id desc");
|
||||
break;
|
||||
default:
|
||||
throw new \Exception("不支持的排序类型");
|
||||
}
|
||||
|
||||
// if(isset($nearby) && $nearby) {
|
||||
//// throw new \Exception("现版本不支持");
|
||||
// $selfetch = $selfetch->having("distance <= {$nearby}");
|
||||
// }
|
||||
if($count){
|
||||
$total = $selfetch->count();
|
||||
return $total;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$selfetch = $selfetch->page($page,$limit)->select();
|
||||
|
||||
|
||||
// foreach ($selfetch as $row) {
|
||||
//
|
||||
//// $row->getRelation('manystore')->visible(['nickname']);
|
||||
//// $row->getRelation('user')->visible(['nickname','avatar']);
|
||||
// }
|
||||
$rows = $selfetch;
|
||||
// $total = $selfetch->total();
|
||||
|
||||
|
||||
|
||||
//额外附加数据
|
||||
foreach ($rows as &$row) { //迭代器魔术方法遍历,填值自动引用传值
|
||||
//设置是否已收藏
|
||||
if (isset($my) && $my) {
|
||||
if (isset($my_user_id) && $my_user_id) {
|
||||
//正常全显示
|
||||
}else{
|
||||
$row["name"] = "***";
|
||||
if($row["idnum"] && $row["open"] == '0'){
|
||||
//替换除了前三位往后所有字符为*
|
||||
$row["idnum"] = substr_replace($row["idnum"], "***", 3, -4);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// $classes_cate_ids = $row['cate_ids'];
|
||||
// $classes_cate = [];
|
||||
// foreach (explode(",", $classes_cate_ids) as $classes_cate_id){
|
||||
// if(isset($cate_list[$classes_cate_id]))$classes_cate[] = $cate_list[$classes_cate_id];
|
||||
// }
|
||||
// $row['cate'] = $classes_cate;
|
||||
|
||||
}
|
||||
// $result = array("data" => $rows);
|
||||
return $rows;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -508,6 +508,34 @@ class Activity extends ManystoreBase
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 微信短链接
|
||||
* @return string
|
||||
* @throws \think\Exception
|
||||
* @throws \think\db\exception\BindParamException
|
||||
* @throws \think\exception\DbException
|
||||
* @throws \think\exception\PDOException
|
||||
*/
|
||||
public function miniurl($ids = ''){
|
||||
$param = $this->request->param();
|
||||
if($this->request->isPost()){
|
||||
try{
|
||||
if(isset($param['ids']))$ids = $param['ids'];
|
||||
//设置模拟资格
|
||||
$url = \app\common\model\school\activity\Activity::getMiniQrcodeLink($ids);
|
||||
|
||||
}catch (\Exception $e){
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
$this->success($url["url_link"]);
|
||||
}
|
||||
$row = $this->model->get($ids);
|
||||
$this->view->assign('vo', $row);
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 微信小程序码
|
||||
* @return string
|
||||
|
@ -24,8 +24,8 @@
|
||||
<div class="input-group">
|
||||
<input id="c-images" data-rule="required" class="form-control" size="50" name="row[images]" type="text">
|
||||
<div class="input-group-addon no-border no-padding">
|
||||
<span><button type="button" id="faupload-images" class="btn btn-danger faupload" data-input-id="c-images" data-maxcount="5" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
|
||||
<span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-input-id="c-images" data-maxcount="5" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
|
||||
<span><button type="button" id="faupload-images" class="btn btn-danger faupload" data-input-id="c-images" data-maxcount="9" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
|
||||
<span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-input-id="c-images" data-maxcount="9" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
|
||||
</div>
|
||||
<span class="msg-box n-right" for="c-images"></span>
|
||||
</div>
|
||||
|
@ -27,8 +27,8 @@
|
||||
<div class="input-group">
|
||||
<input id="c-images" data-rule="required" class="form-control" size="50" name="row[images]" type="text" value="{$row.images|htmlentities}">
|
||||
<div class="input-group-addon no-border no-padding">
|
||||
<span><button type="button" id="faupload-images" class="btn btn-danger faupload" data-maxcount="5" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
|
||||
<span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-maxcount="5" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
|
||||
<span><button type="button" id="faupload-images" class="btn btn-danger faupload" data-maxcount="9" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
|
||||
<span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-maxcount="9" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
|
||||
</div>
|
||||
<span class="msg-box n-right" for="c-images"></span>
|
||||
</div>
|
||||
|
@ -27,8 +27,8 @@
|
||||
<div class="input-group">
|
||||
<input id="c-images" data-rule="required" class="form-control" size="50" name="row[images]" type="text" value="{$row.images|htmlentities}">
|
||||
<div class="input-group-addon no-border no-padding">
|
||||
<span><button type="button" id="faupload-images" class="btn btn-danger faupload" data-maxcount="5" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
|
||||
<span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-maxcount="5" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
|
||||
<span><button type="button" id="faupload-images" class="btn btn-danger faupload" data-maxcount="9" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
|
||||
<span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-maxcount="9" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
|
||||
</div>
|
||||
<span class="msg-box n-right" for="c-images"></span>
|
||||
</div>
|
||||
|
@ -16,6 +16,8 @@ define(['jquery', 'bootstrap', 'backend', 'csmtable', 'form'], function ($, unde
|
||||
|
||||
lookminiqrcode_url: 'school/activity/activity/lookminiqrcode',
|
||||
miniqrcode_url: 'school/activity/activity/miniqrcode',
|
||||
url_url: 'school/activity/activity/url',
|
||||
miniurl_url: 'school/activity/activity/miniurl',
|
||||
|
||||
table: 'school_activity',
|
||||
}
|
||||
@ -110,6 +112,70 @@ define(['jquery', 'bootstrap', 'backend', 'csmtable', 'form'], function ($, unde
|
||||
|
||||
{field: 'operate', title: __('Operate'), table: table , buttons: [
|
||||
|
||||
{name: 'url',
|
||||
text: '查看小程序内链',
|
||||
icon: 'fa fa-chain',
|
||||
classname: 'btn btn-ajax',
|
||||
url: $.fn.bootstrapTable.defaults.extend.url_url,
|
||||
confirm: '查看小程序内部连接,用于配置轮播图跳转',
|
||||
dropdown : '更多',
|
||||
success: function (data, ret) {
|
||||
//JS将内容放入复制板
|
||||
try {
|
||||
navigator.clipboard.writeText(ret.msg);
|
||||
console.log('Text copied to clipboard');
|
||||
Layer.alert("已自动复制内容 : " + ret.msg );
|
||||
} catch (err) {
|
||||
console.error('Failed to copy: ', err);
|
||||
Layer.alert("浏览器不支持复制,请自行复制 : " + ret.msg );
|
||||
}
|
||||
|
||||
$(".btn-refresh").trigger("click");
|
||||
},
|
||||
error: function (data, ret) {
|
||||
Layer.alert(ret.msg);
|
||||
return false;
|
||||
},
|
||||
// visible: function (row) {
|
||||
// //显示条件 只能待入住订单
|
||||
// if(row.status == '3'){
|
||||
// return true;
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
},
|
||||
{name: 'miniurl',
|
||||
text: '查看小程序外链',
|
||||
icon: 'fa fa-chain',
|
||||
classname: 'btn btn-ajax',
|
||||
url: $.fn.bootstrapTable.defaults.extend.miniurl_url,
|
||||
confirm: '查看小程序外部连接,用于第三方程序引流,网址跳转用',
|
||||
dropdown : '更多',
|
||||
success: function (data, ret) {
|
||||
//JS将内容放入复制板
|
||||
try {
|
||||
navigator.clipboard.writeText(ret.msg);
|
||||
console.log('Text copied to clipboard');
|
||||
Layer.alert("已自动复制内容 : " + ret.msg );
|
||||
} catch (err) {
|
||||
console.error('Failed to copy: ', err);
|
||||
Layer.alert("浏览器不支持复制,请自行复制 : " + ret.msg );
|
||||
}
|
||||
|
||||
$(".btn-refresh").trigger("click");
|
||||
},
|
||||
error: function (data, ret) {
|
||||
Layer.alert(ret.msg);
|
||||
return false;
|
||||
},
|
||||
// visible: function (row) {
|
||||
// //显示条件 只能待入住订单
|
||||
// if(row.status == '3'){
|
||||
// return true;
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
},
|
||||
{name: 'cancel',
|
||||
text: '取消活动',
|
||||
icon: 'fa fa-user-times',
|
||||
|
@ -17,6 +17,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||
|
||||
lookminiqrcode_url: 'school/activity/activity/lookminiqrcode',
|
||||
miniqrcode_url: 'school/activity/activity/miniqrcode',
|
||||
url_url: 'school/activity/activity/url',
|
||||
miniurl_url: 'school/activity/activity/miniurl',
|
||||
|
||||
|
||||
table: 'school_activity',
|
||||
}
|
||||
@ -110,6 +113,72 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||
|
||||
{field: 'operate', title: __('Operate'), table: table , buttons: [
|
||||
|
||||
{name: 'url',
|
||||
text: '查看小程序内链',
|
||||
icon: 'fa fa-chain',
|
||||
classname: 'btn btn-ajax',
|
||||
url: $.fn.bootstrapTable.defaults.extend.url_url,
|
||||
confirm: '查看小程序内部连接,用于配置轮播图跳转',
|
||||
dropdown : '更多',
|
||||
success: function (data, ret) {
|
||||
//JS将内容放入复制板
|
||||
try {
|
||||
navigator.clipboard.writeText(ret.msg);
|
||||
console.log('Text copied to clipboard');
|
||||
Layer.alert("已自动复制内容 : " + ret.msg );
|
||||
} catch (err) {
|
||||
console.error('Failed to copy: ', err);
|
||||
Layer.alert("浏览器不支持复制,请自行复制 : " + ret.msg );
|
||||
}
|
||||
|
||||
$(".btn-refresh").trigger("click");
|
||||
},
|
||||
error: function (data, ret) {
|
||||
Layer.alert(ret.msg);
|
||||
return false;
|
||||
},
|
||||
// visible: function (row) {
|
||||
// //显示条件 只能待入住订单
|
||||
// if(row.status == '3'){
|
||||
// return true;
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
},
|
||||
{name: 'miniurl',
|
||||
text: '查看小程序外链',
|
||||
icon: 'fa fa-chain',
|
||||
classname: 'btn btn-ajax',
|
||||
url: $.fn.bootstrapTable.defaults.extend.miniurl_url,
|
||||
confirm: '查看小程序外部连接,用于第三方程序引流,网址跳转用',
|
||||
dropdown : '更多',
|
||||
success: function (data, ret) {
|
||||
//JS将内容放入复制板
|
||||
try {
|
||||
navigator.clipboard.writeText(ret.msg);
|
||||
console.log('Text copied to clipboard');
|
||||
Layer.alert("已自动复制内容 : " + ret.msg );
|
||||
} catch (err) {
|
||||
console.error('Failed to copy: ', err);
|
||||
Layer.alert("浏览器不支持复制,请自行复制 : " + ret.msg );
|
||||
}
|
||||
|
||||
$(".btn-refresh").trigger("click");
|
||||
},
|
||||
error: function (data, ret) {
|
||||
Layer.alert(ret.msg);
|
||||
return false;
|
||||
},
|
||||
// visible: function (row) {
|
||||
// //显示条件 只能待入住订单
|
||||
// if(row.status == '3'){
|
||||
// return true;
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
},
|
||||
|
||||
|
||||
{name: 'cancel',
|
||||
text: '取消活动',
|
||||
icon: 'fa fa-user-times',
|
||||
|
Loading…
x
Reference in New Issue
Block a user