修复搜分类名搜索不生效问题
This commit is contained in:
parent
3a92a48b3a
commit
6026f3a50e
@ -25,6 +25,44 @@ class WechatUtil extends Api
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @ApiTitle(微信小程序生成二维码)
|
||||
* @ApiSummary(微信小程序生成二维码)
|
||||
* @ApiRoute(/api/wechat_util/qrcode)
|
||||
* @ApiMethod(POST)
|
||||
* @ApiParams (name="path", type="string", required=false, description="通过 scheme 码进入的小程序页面路径,必须是已经发布的小程序存在的页面,不可携带 query。path 为空时会跳转小程序主页。")
|
||||
* @ApiReturn({
|
||||
"code" => 1,
|
||||
"msg" => "获取成功",
|
||||
"data" => {}
|
||||
*})
|
||||
*/
|
||||
public function qrcode() {
|
||||
$q_params = [];
|
||||
$path = $this->request->param('path/s','pages/index/index');
|
||||
|
||||
try {
|
||||
// 实例对应的接口对象
|
||||
|
||||
//图片流
|
||||
$stream = \bw\Common::getMiniappQrCode($path);
|
||||
|
||||
|
||||
} catch (\Exception $e){
|
||||
// Log::log($e->getMessage());
|
||||
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
|
||||
}
|
||||
|
||||
// //直接返回图片
|
||||
// header('Content-Type: image/png');
|
||||
// echo $stream;
|
||||
|
||||
$this->success('生成成功', $stream);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @ApiTitle(微信小程序生成url-scheme)
|
||||
|
@ -292,4 +292,49 @@ class Header extends Base
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @ApiTitle( 申请列表接口)
|
||||
* @ApiSummary(申请列表接口)
|
||||
* @ApiMethod(GET)
|
||||
* @ApiParams(name = "keywords", type = "string",required=false,description = "搜索关键字")
|
||||
* @ApiParams(name = "page", type = "string",required=true,description = "页数")
|
||||
* @ApiParams(name = "limit", type = "string",required=true,description = "条数")
|
||||
* @ApiParams(name = "status", type = "string",required=false,description = "申请状态:1=申请中,2=已开票,-3=作废")
|
||||
* @ApiReturn({
|
||||
*
|
||||
*})
|
||||
*/
|
||||
public function apply_list()
|
||||
{
|
||||
$this->model = new Apply();
|
||||
$user_id = 0;
|
||||
$user = $this->auth->getUser();//登录用户
|
||||
if($user)$user_id = $user['id'];
|
||||
|
||||
$params = [];
|
||||
$params['user_id'] = $user_id;
|
||||
$page = $this->request->get('page/d', 0); //页数
|
||||
$limit = $this->request->get('limit/d', 0); //条数
|
||||
$params["keywords"] = $this->request->get('keywords/s', ''); //搜索关键字
|
||||
$params["status"] = $this->request->get('status/s', ''); //搜索关键字
|
||||
|
||||
// $params["time"] = $this->request->get('time/s', ''); //时间
|
||||
|
||||
try{
|
||||
//当前申请状态
|
||||
$res = $this->model::applyList($page, $limit,$params);
|
||||
// if($user_id =='670153'){
|
||||
// file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
|
||||
// }
|
||||
}catch (\Exception $e){
|
||||
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
$this->success('查询成功', $res);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -792,15 +792,20 @@ class Activity extends BaseModel
|
||||
|
||||
if($keywords_cate_ids){
|
||||
$keywords_cate_ids = implode("|",$keywords_cate_ids);
|
||||
$selfetch = $selfetch->whereRaw(" {$a}cate_ids REGEXP '({$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}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}title|{$a}address|{$a}address_detail|{$a}address_city", 'like', '%' . $keywords . '%');
|
||||
}
|
||||
|
||||
$selfetch = $selfetch->where("{$a}title|{$a}address|{$a}address_detail|{$a}address_city", 'like', '%' . $keywords . '%');
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1300,7 +1305,8 @@ class Activity extends BaseModel
|
||||
$params["sale"] = self::activitySale($id);
|
||||
//统计课程总报名和总核销
|
||||
$params["sign_num"] = Order::where("activity_id",$id)->where("status","not in",["-3","5","6"])->sum("num");
|
||||
$params["verification_num"] = OrderCode::where("activity_id",$id)->where("status","=","6")->count();
|
||||
$as = (new OrderCode)->getWithAlisaName();
|
||||
$params["verification_num"] = OrderCode::with("activityorder")->where("activityorder.status","not in",["-3","5","6"])->where("{$as}.activity_id",$id)->where("{$as}.status","=","6")->count();
|
||||
//设置课程收藏
|
||||
$params["collect"] = Collect::where("classes_activity_id",$id)->count();
|
||||
|
||||
|
@ -402,4 +402,80 @@ class Apply extends BaseModel
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**得到基础条件
|
||||
* @param $status
|
||||
* @param null $model
|
||||
* @param string $alisa
|
||||
*/
|
||||
public static function getBaseWhere($whereData = [], $model = null, $alisa = '',$with = false)
|
||||
{
|
||||
|
||||
if (!$model) {
|
||||
$model = new static;
|
||||
if ($alisa&&!$with) $model = $model->alias($alisa);
|
||||
}
|
||||
if ($alisa) $alisa = $alisa . '.';
|
||||
$tableFields = (new static)->getTableFields();
|
||||
foreach ($tableFields as $fields)
|
||||
{
|
||||
if(in_array($fields, ["user_id","status"]))continue;
|
||||
// if (isset($whereData[$fields]) && $whereData[$fields]) $model = $model->where("{$alisa}{$fields}", '=', $whereData[$fields]);
|
||||
|
||||
if (isset($whereData[$fields]) && $whereData[$fields]){
|
||||
if(is_array($whereData[$fields])){
|
||||
$model = $model->where("{$alisa}{$fields}", $whereData[$fields][0], $whereData[$fields][1]);
|
||||
}else{
|
||||
$model = $model->where("{$alisa}{$fields}", '=', $whereData[$fields]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if (isset($whereData['user_id']) && $whereData['user_id']) $model = $model->where("{$alisa}user_id", 'in', $whereData['user_id']);
|
||||
|
||||
if (isset($whereData['keywords'])&&$whereData['keywords']) $model = $model->where("{$alisa}invoice_header|{$alisa}tax_id|{$alisa}bank_number|{$alisa}invoice_reservation_phone|{$alisa}invoice_reservation_email", 'like', "%". $whereData['keywords']."%");
|
||||
|
||||
if (isset($whereData['time'])&&$whereData['time']){
|
||||
$model = $model->time(["{$alisa}createtime",$whereData['time']]);
|
||||
}
|
||||
|
||||
|
||||
if (isset($whereData['status']) && $whereData['status']) $model = $model->where("{$alisa}status", 'in', $whereData['status']);
|
||||
if (isset($whereData['not_status']) && $whereData['not_status']) $model = $model->where("{$alisa}status", 'not in', $whereData['not_status']);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static function applyList($page, $limit,$params=[]){
|
||||
$with_field = [
|
||||
'base'=>['*'],
|
||||
"activityorders"=>['*'],
|
||||
];
|
||||
// $alisa = (new self)->getWithAlisaName();
|
||||
// $sort = "{$alisa}.id desc";
|
||||
|
||||
$sort = "id desc";
|
||||
|
||||
$serch_where = [];
|
||||
$serch_where = array_merge($serch_where,$params);
|
||||
return (new self)->getBaseList($serch_where, $page, $limit,$sort,$with_field);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -9,8 +9,8 @@ return [
|
||||
/**
|
||||
* CDN地址
|
||||
*/
|
||||
// 'cdnurl' => 'https://qingchunta.hschool.com.cn',
|
||||
'cdnurl' => '',
|
||||
'cdnurl' => 'https://qingchunta.hschool.com.cn',
|
||||
//'cdnurl' => '',
|
||||
/**
|
||||
* 文件保存格式
|
||||
*/
|
||||
|
@ -381,11 +381,14 @@ class Common
|
||||
if (empty($path)) {
|
||||
$path = 'pages/index/index';
|
||||
}
|
||||
$wechat = new \addons\shopro\library\Wechat('wxMiniProgram');
|
||||
$content = $wechat->getApp()->app_code->getQrCode($path);
|
||||
if ($content instanceof \EasyWeChat\Kernel\Http\StreamResponse) {
|
||||
// $wechat = new \addons\shopro\library\Wechat('wxMiniProgram');
|
||||
// $content = $wechat->getApp()->app_code->getQrCode($path);
|
||||
|
||||
$qrcode = new \WeMini\Qrcode(Service::wechatConfig());
|
||||
$content = $qrcode->createDefault($path, $width = 430, $outType = null);
|
||||
// if ($content instanceof \EasyWeChat\Kernel\Http\StreamResponse) {
|
||||
$filePath = ROOT_PATH . 'public/uploads/qrcode/' . $file_name;
|
||||
$content->saveAs(ROOT_PATH . 'public/uploads/qrcode', $file_name);
|
||||
file_put_contents($filePath, $content);
|
||||
//保存到fastadmin框架
|
||||
$attachment = Common::setFastAdminFile($filePath, $file_name);
|
||||
$attachment['full_url'] = cdnurl($attachment['url'],true);
|
||||
@ -399,13 +402,14 @@ class Common
|
||||
@unlink($filePath);
|
||||
return $attachment;
|
||||
|
||||
} else {
|
||||
// 小程序码获取失败
|
||||
$msg = isset($content['errcode']) ? $content['errcode'] : '-';
|
||||
$msg .= isset($content['errmsg']) ? $content['errmsg'] : '';
|
||||
\think\Log::write('wxacode-error' . $msg);
|
||||
throw new \Exception($msg);
|
||||
}
|
||||
// } else {
|
||||
//// var_dump(gettype($content));
|
||||
// // 小程序码获取失败
|
||||
// $msg = isset($content['errcode']) ? $content['errcode'] : '-';
|
||||
// $msg .= isset($content['errmsg']) ? $content['errmsg'] : '';
|
||||
// \think\Log::write('wxacode-error' . $msg);
|
||||
// throw new \Exception($msg);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user