parent
b94e54aec7
commit
9b8d02bd4b
|
@ -62,8 +62,10 @@ class Attachment extends Backend
|
||||||
$list = $this->model
|
$list = $this->model
|
||||||
->where($mimetypeQuery)
|
->where($mimetypeQuery)
|
||||||
->where($where)
|
->where($where)
|
||||||
|
->whereRaw("`filename` NOT REGEXP '^[0-9A-Fa-f]{32}'")
|
||||||
->order($sort, $order)
|
->order($sort, $order)
|
||||||
->paginate($limit);
|
->paginate($limit);
|
||||||
|
// var_dump($this->model->getLastSql());
|
||||||
|
|
||||||
$cdnurl = preg_replace("/\/(\w+)\.php$/i", '', $this->request->root());
|
$cdnurl = preg_replace("/\/(\w+)\.php$/i", '', $this->request->root());
|
||||||
foreach ($list as $k => &$v) {
|
foreach ($list as $k => &$v) {
|
||||||
|
|
|
@ -4,6 +4,18 @@ namespace app\admin\controller\manystore;
|
||||||
|
|
||||||
use app\common\controller\Backend;
|
use app\common\controller\Backend;
|
||||||
|
|
||||||
|
use app\common\model\User;
|
||||||
|
use app\manystore\model\Manystore;
|
||||||
|
use fast\Tree;
|
||||||
|
use think\Db;
|
||||||
|
use think\db\exception\DataNotFoundException;
|
||||||
|
use think\db\exception\ModelNotFoundException;
|
||||||
|
use think\Exception;
|
||||||
|
use think\exception\DbException;
|
||||||
|
use think\exception\PDOException;
|
||||||
|
use think\exception\ValidateException;
|
||||||
|
use think\Model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 授权机构用户
|
* 授权机构用户
|
||||||
*
|
*
|
||||||
|
@ -17,11 +29,14 @@ class UserAuth extends Backend
|
||||||
* @var \app\admin\model\manystore\UserAuth
|
* @var \app\admin\model\manystore\UserAuth
|
||||||
*/
|
*/
|
||||||
protected $model = null;
|
protected $model = null;
|
||||||
|
protected $qSwitch = true;
|
||||||
|
protected $qFields = ["shop_id","user_id"];
|
||||||
|
|
||||||
public function _initialize()
|
public function _initialize()
|
||||||
{
|
{
|
||||||
parent::_initialize();
|
|
||||||
$this->model = new \app\admin\model\manystore\UserAuth;
|
$this->model = new \app\admin\model\manystore\UserAuth;
|
||||||
|
parent::_initialize();
|
||||||
|
|
||||||
$this->view->assign("statusList", $this->model->getStatusList());
|
$this->view->assign("statusList", $this->model->getStatusList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +74,7 @@ class UserAuth extends Backend
|
||||||
foreach ($list as $row) {
|
foreach ($list as $row) {
|
||||||
|
|
||||||
$row->getRelation('shop')->visible(['name']);
|
$row->getRelation('shop')->visible(['name']);
|
||||||
$row->getRelation('user')->visible(['nickname','avatar']);
|
$row->getRelation('user')->visible(['nickname','avatar','mobile']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||||
|
@ -69,4 +84,197 @@ class UserAuth extends Backend
|
||||||
return $this->view->fetch();
|
return $this->view->fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected function updateCheck($id,$params=[],$row=null){
|
||||||
|
|
||||||
|
// 课程存在售后订单则不允许操作
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function update_check(&$params,$row=null)
|
||||||
|
{
|
||||||
|
|
||||||
|
$shop_id = $params["shop_id"];
|
||||||
|
$manystore = Manystore::where("shop_id",$shop_id)->find();
|
||||||
|
if(!$manystore){
|
||||||
|
$this->error("店铺不存在");
|
||||||
|
}
|
||||||
|
//用户不存在
|
||||||
|
$user_id = $params["user_id"];
|
||||||
|
$user = User::where("id",$user_id)->find();
|
||||||
|
if(!$user){
|
||||||
|
$this->error("用户不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
//修改
|
||||||
|
if($row){
|
||||||
|
//用户已是其他的教师(搜索)
|
||||||
|
$teacher_user = $this->model->where("user_id",$user_id)->where("shop_id",$shop_id)->where("id","<>",$row["id"])->find();
|
||||||
|
if($teacher_user){
|
||||||
|
$this->error("已向用户发起过授权申请!");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
//新增
|
||||||
|
//用户已是教师(搜索)
|
||||||
|
$teacher_user = $this->model->where("user_id",$user_id)->where("shop_id",$shop_id)->find();
|
||||||
|
if($teacher_user){
|
||||||
|
$this->error("已向用户发起过授权申请!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// $params["manystore_id"] = $manystore["id"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加
|
||||||
|
*
|
||||||
|
* @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);
|
||||||
|
}
|
||||||
|
$this->update_check($params,$row=null);
|
||||||
|
// $result = $this->model->allowField(true)->save($params);
|
||||||
|
|
||||||
|
$result = \app\common\model\manystore\UserAuth::auth(0,$params["shop_id"],$params["user_id"],$params["status"],'admin',$this->auth->id);
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
$this->update_check($params,$row);
|
||||||
|
// $result = $row->allowField(true)->save($params);
|
||||||
|
$result = \app\common\model\manystore\UserAuth::auth($row["id"],$params["shop_id"],$params["user_id"],$params["status"],'admin',$this->auth->id);
|
||||||
|
|
||||||
|
Db::commit();
|
||||||
|
} catch (ValidateException|PDOException|\Exception $e) {
|
||||||
|
Db::rollback();
|
||||||
|
$this->error($e->getMessage());
|
||||||
|
}
|
||||||
|
if (false === $result) {
|
||||||
|
$this->error(__('No rows were updated'));
|
||||||
|
}
|
||||||
|
$this->success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*
|
||||||
|
* @param $ids
|
||||||
|
* @return void
|
||||||
|
* @throws DbException
|
||||||
|
* @throws DataNotFoundException
|
||||||
|
* @throws ModelNotFoundException
|
||||||
|
*/
|
||||||
|
public function del($ids = null)
|
||||||
|
{
|
||||||
|
if (false === $this->request->isPost()) {
|
||||||
|
$this->error(__("Invalid parameters"));
|
||||||
|
}
|
||||||
|
$ids = $ids ?: $this->request->post("ids");
|
||||||
|
if (empty($ids)) {
|
||||||
|
$this->error(__('Parameter %s can not be empty', 'ids'));
|
||||||
|
}
|
||||||
|
$pk = $this->model->getPk();
|
||||||
|
$adminIds = $this->getDataLimitAdminIds();
|
||||||
|
if (is_array($adminIds)) {
|
||||||
|
$this->model->where($this->dataLimitField, 'in', $adminIds);
|
||||||
|
}
|
||||||
|
$list = $this->model->where($pk, 'in', $ids)->select();
|
||||||
|
foreach ($list as $item) {
|
||||||
|
$this->updateCheck($item->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$count = 0;
|
||||||
|
Db::startTrans();
|
||||||
|
try {
|
||||||
|
foreach ($list as $item) {
|
||||||
|
$count += $item->delete();
|
||||||
|
}
|
||||||
|
Db::commit();
|
||||||
|
} catch (PDOException|Exception $e) {
|
||||||
|
Db::rollback();
|
||||||
|
$this->error($e->getMessage());
|
||||||
|
}
|
||||||
|
if ($count) {
|
||||||
|
$this->success();
|
||||||
|
}
|
||||||
|
$this->error(__('No rows were deleted'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,73 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\admin\controller\school\classes;
|
||||||
|
|
||||||
|
use app\common\controller\Backend;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 免费课黑名单
|
||||||
|
*
|
||||||
|
* @icon fa fa-circle-o
|
||||||
|
*/
|
||||||
|
class Blacklist extends Backend
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blacklist模型对象
|
||||||
|
* @var \app\admin\model\school\classes\Blacklist
|
||||||
|
*/
|
||||||
|
protected $model = null;
|
||||||
|
protected $qSwitch = true;
|
||||||
|
protected $qFields = ["user_id"];
|
||||||
|
|
||||||
|
public function _initialize()
|
||||||
|
{
|
||||||
|
$this->model = new \app\admin\model\school\classes\Blacklist;
|
||||||
|
parent::_initialize();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||||
|
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||||
|
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查看
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
//当前是否为关联查询
|
||||||
|
$this->relationSearch = true;
|
||||||
|
//设置过滤方法
|
||||||
|
$this->request->filter(['strip_tags', 'trim']);
|
||||||
|
if ($this->request->isAjax()) {
|
||||||
|
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||||
|
if ($this->request->request('keyField')) {
|
||||||
|
return $this->selectpage();
|
||||||
|
}
|
||||||
|
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||||
|
|
||||||
|
$list = $this->model
|
||||||
|
->with(['user'])
|
||||||
|
->where($where)
|
||||||
|
->order($sort, $order)
|
||||||
|
->paginate($limit);
|
||||||
|
|
||||||
|
foreach ($list as $row) {
|
||||||
|
|
||||||
|
$row->getRelation('user')->visible(['nickname','realname','mobile','avatar']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||||
|
|
||||||
|
return json($result);
|
||||||
|
}
|
||||||
|
return $this->view->fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -3,6 +3,7 @@
|
||||||
namespace app\admin\controller\school\classes;
|
namespace app\admin\controller\school\classes;
|
||||||
|
|
||||||
use app\common\controller\Backend;
|
use app\common\controller\Backend;
|
||||||
|
use app\common\model\manystore\UserAuth;
|
||||||
use app\common\model\User;
|
use app\common\model\User;
|
||||||
use app\manystore\model\Manystore;
|
use app\manystore\model\Manystore;
|
||||||
use fast\Tree;
|
use fast\Tree;
|
||||||
|
@ -33,7 +34,7 @@ class Teacher extends Backend
|
||||||
protected $searchFields = 'id,name,user_id';
|
protected $searchFields = 'id,name,user_id';
|
||||||
|
|
||||||
protected $qSwitch = true;
|
protected $qSwitch = true;
|
||||||
protected $qFields = ["manystore_id","shop_id"];
|
protected $qFields = ["manystore_id","shop_id","user_id"];
|
||||||
|
|
||||||
public function _initialize()
|
public function _initialize()
|
||||||
{
|
{
|
||||||
|
@ -254,6 +255,14 @@ class Teacher extends Backend
|
||||||
$this->error("用户不存在");
|
$this->error("用户不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//如果开启了检测用户授权,则检测用户是否授权
|
||||||
|
if(config("site.shop_auth_user_check")){
|
||||||
|
if(!UserAuth::authcheck($shop_id,$user["id"])) $this->error("用户未授权当前机构!请先让用户授权同意您再操作!");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//修改
|
//修改
|
||||||
if($row){
|
if($row){
|
||||||
//用户已是其他的教师(搜索)
|
//用户已是其他的教师(搜索)
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
namespace app\admin\controller\school\classes;
|
namespace app\admin\controller\school\classes;
|
||||||
|
|
||||||
use app\common\controller\Backend;
|
use app\common\controller\Backend;
|
||||||
|
use app\common\model\manystore\UserAuth;
|
||||||
use app\common\model\User;
|
use app\common\model\User;
|
||||||
use app\manystore\model\Manystore;
|
use app\manystore\model\Manystore;
|
||||||
use think\Db;
|
use think\Db;
|
||||||
|
@ -28,7 +29,7 @@ class Verification extends Backend
|
||||||
protected $model = null;
|
protected $model = null;
|
||||||
|
|
||||||
protected $qSwitch = true;
|
protected $qSwitch = true;
|
||||||
protected $qFields = ["manystore_id","shop_id"];
|
protected $qFields = ["manystore_id","shop_id","user_id"];
|
||||||
|
|
||||||
public function _initialize()
|
public function _initialize()
|
||||||
{
|
{
|
||||||
|
@ -106,6 +107,10 @@ class Verification extends Backend
|
||||||
$this->error("用户不存在");
|
$this->error("用户不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(config("site.shop_auth_user_check")){
|
||||||
|
if(!UserAuth::authcheck($shop_id,$user["id"])) $this->error("用户未授权当前机构!请先让用户授权同意您再操作!");
|
||||||
|
}
|
||||||
|
|
||||||
//修改
|
//修改
|
||||||
if($row){
|
if($row){
|
||||||
//用户已是其他的教师(搜索)
|
//用户已是其他的教师(搜索)
|
||||||
|
|
|
@ -265,6 +265,7 @@ class User extends Backend
|
||||||
if(!$user)$user = (new \app\common\model\User)->addUserByMobile($people_mobile,$people_name);
|
if(!$user)$user = (new \app\common\model\User)->addUserByMobile($people_mobile,$people_name);
|
||||||
$user['nickname'] = $people_name;
|
$user['nickname'] = $people_name;
|
||||||
$user->save();
|
$user->save();
|
||||||
|
|
||||||
}catch (\Exception $e){
|
}catch (\Exception $e){
|
||||||
$this->error($e->getMessage());
|
$this->error($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,5 +15,9 @@ return [
|
||||||
'Update_time' => '修改时间',
|
'Update_time' => '修改时间',
|
||||||
'Shop.name' => '店铺名称',
|
'Shop.name' => '店铺名称',
|
||||||
'User.nickname' => '昵称',
|
'User.nickname' => '昵称',
|
||||||
'User.avatar' => '头像'
|
'User.avatar' => '头像',
|
||||||
|
'Add' => '添加用户授权申请',
|
||||||
|
'Delete'=>'取消授权',
|
||||||
|
'Del'=>'取消授权',
|
||||||
|
'User.mobile'=>'用户手机号',
|
||||||
];
|
];
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'User_id' => '授权用户',
|
||||||
|
'Createtime' => '发起时间',
|
||||||
|
'Updatetime' => '修改时间',
|
||||||
|
'User.nickname' => '昵称',
|
||||||
|
'User.realname' => '真实姓名',
|
||||||
|
'User.mobile' => '手机号',
|
||||||
|
'User.avatar' => '头像'
|
||||||
|
];
|
|
@ -17,7 +17,7 @@ return [
|
||||||
'Type' => '地点类型',
|
'Type' => '地点类型',
|
||||||
'Type out' => '户外',
|
'Type out' => '户外',
|
||||||
'Type in' => '室内',
|
'Type in' => '室内',
|
||||||
'Classes_num' => '课时数',
|
'Classes_num' => '多少节课',
|
||||||
'Address_type' => '地址类型',
|
'Address_type' => '地址类型',
|
||||||
'Address_type 1' => '按机构',
|
'Address_type 1' => '按机构',
|
||||||
'Address_type 2' => '独立位置',
|
'Address_type 2' => '独立位置',
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\admin\model\school\classes;
|
||||||
|
|
||||||
|
use think\Model;
|
||||||
|
|
||||||
|
|
||||||
|
class Blacklist extends Model
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 表名
|
||||||
|
protected $name = 'school_classes_blacklist';
|
||||||
|
|
||||||
|
// 自动写入时间戳字段
|
||||||
|
protected $autoWriteTimestamp = 'integer';
|
||||||
|
|
||||||
|
// 定义时间戳字段名
|
||||||
|
protected $createTime = 'createtime';
|
||||||
|
protected $updateTime = 'updatetime';
|
||||||
|
protected $deleteTime = false;
|
||||||
|
|
||||||
|
// 追加属性
|
||||||
|
protected $append = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\admin\validate\school\classes;
|
||||||
|
|
||||||
|
use think\Validate;
|
||||||
|
|
||||||
|
class Blacklist extends Validate
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 验证规则
|
||||||
|
*/
|
||||||
|
protected $rule = [
|
||||||
|
];
|
||||||
|
/**
|
||||||
|
* 提示消息
|
||||||
|
*/
|
||||||
|
protected $message = [
|
||||||
|
];
|
||||||
|
/**
|
||||||
|
* 验证场景
|
||||||
|
*/
|
||||||
|
protected $scene = [
|
||||||
|
'add' => [],
|
||||||
|
'edit' => [],
|
||||||
|
];
|
||||||
|
|
||||||
|
}
|
|
@ -3,13 +3,13 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label col-xs-12 col-sm-2">{:__('Shop_id')}:</label>
|
<label class="control-label col-xs-12 col-sm-2">{:__('Shop_id')}:</label>
|
||||||
<div class="col-xs-12 col-sm-8">
|
<div class="col-xs-12 col-sm-8">
|
||||||
<input id="c-shop_id" data-rule="required" data-source="dyqc/manystore_shop/index" class="form-control selectpage" name="row[shop_id]" type="text" value="">
|
<input id="c-shop_id" data-rule="required" data-source="dyqc/manystore_shop/index" class="form-control selectpage" name="row[shop_id]" type="text" value="{$q_shop_id}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
|
<label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
|
||||||
<div class="col-xs-12 col-sm-8">
|
<div class="col-xs-12 col-sm-8">
|
||||||
<input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="mobile" data-format-item="{id} - {nickname} - {mobile}" class="form-control selectpage" name="row[user_id]" type="text" value="">
|
<input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="mobile" data-format-item="{id} - {nickname} - {mobile}" class="form-control selectpage" name="row[user_id]" type="text" value="{$q_user_id}">
|
||||||
<span style="color: red">
|
<span style="color: red">
|
||||||
|
|
||||||
(没找到用户则点击按钮创建用户后重新下拉框选用户)
|
(没找到用户则点击按钮创建用户后重新下拉框选用户)
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
<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" data-source="user/user/index" data-field="mobile" data-format-item="{id} - {nickname} - {mobile}" class="form-control selectpage" name="row[user_id]" type="text" value="{$q_user_id}">
|
||||||
|
<span style="color: red">
|
||||||
|
|
||||||
|
(没找到用户则点击按钮创建用户后重新下拉框选用户)
|
||||||
|
<a data-url="user/user/changeuser" href="javascript:;" class="btn btn-success btn-changeuser {:$auth->check('user/user/changeuser')?'':'hide'}" title="根据手机号生成用户" ><i class="fa fa-plus"></i> 根据手机号生成用户</a>
|
||||||
|
|
||||||
|
</span>
|
||||||
|
</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>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
|
@ -0,0 +1,22 @@
|
||||||
|
<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" data-source="user/user/index" data-field="mobile" data-format-item="{id} - {nickname} - {mobile}" class="form-control selectpage" name="row[user_id]" type="text" value="{$row.user_id|htmlentities}">
|
||||||
|
<span style="color: red">
|
||||||
|
|
||||||
|
(没找到用户则点击按钮创建用户后重新下拉框选用户)
|
||||||
|
<a data-url="user/user/changeuser" href="javascript:;" class="btn btn-success btn-changeuser {:$auth->check('user/user/changeuser')?'':'hide'}" title="根据手机号生成用户" ><i class="fa fa-plus"></i> 根据手机号生成用户</a>
|
||||||
|
|
||||||
|
</span>
|
||||||
|
|
||||||
|
</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>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
|
@ -0,0 +1,29 @@
|
||||||
|
<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>
|
||||||
|
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('school/classes/blacklist/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
|
||||||
|
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('school/classes/blacklist/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
|
||||||
|
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('school/classes/blacklist/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
|
||||||
|
data-operate-edit="{:$auth->check('school/classes/blacklist/edit')}"
|
||||||
|
data-operate-del="{:$auth->check('school/classes/blacklist/del')}"
|
||||||
|
width="100%">
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -10,6 +10,14 @@
|
||||||
<label class="control-label col-xs-12 col-sm-2">{:__('Shop_id')}:</label>
|
<label class="control-label col-xs-12 col-sm-2">{:__('Shop_id')}:</label>
|
||||||
<div class="col-xs-12 col-sm-8">
|
<div class="col-xs-12 col-sm-8">
|
||||||
<input id="c-shop_id" data-rule="required" data-source="dyqc/manystore_shop/index" class="form-control selectpage" name="row[shop_id]" type="text" value="{$q_shop_id}">
|
<input id="c-shop_id" data-rule="required" data-source="dyqc/manystore_shop/index" class="form-control selectpage" name="row[shop_id]" type="text" value="{$q_shop_id}">
|
||||||
|
|
||||||
|
|
||||||
|
<span style="color: red">
|
||||||
|
|
||||||
|
(没找到机构则点击按钮创建机构后重新下拉框选机构)
|
||||||
|
<a href="javascript:;" data-url="manystore/index/add" class="btn btn-success btn-changeuser {:$auth->check('manystore/index/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
|
||||||
|
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="form-group">-->
|
<!-- <div class="form-group">-->
|
||||||
|
@ -140,7 +148,7 @@
|
||||||
<div class="col-xs-12 col-sm-8">
|
<div class="col-xs-12 col-sm-8">
|
||||||
<div class="radio">
|
<div class="radio">
|
||||||
{foreach name="addressTypeList" item="vo"}
|
{foreach name="addressTypeList" item="vo"}
|
||||||
<label for="row[address_type]-{$key}"><input data-rule="required" id="row[address_type]-{$key}" name="row[address_type]" type="radio" value="{$key}" {in name="key" value="1"}checked{/in} /> {$vo}</label>
|
<label for="row[address_type]-{$key}"><input id="row[address_type]-{$key}" name="row[address_type]" type="radio" value="{$key}" {in name="key" value="1"}checked{/in} /> {$vo}</label>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
<span style="color: red">( 如果选独立位置需填写具体位置信息! )</span>
|
<span style="color: red">( 如果选独立位置需填写具体位置信息! )</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -49,6 +49,14 @@
|
||||||
<label class="control-label col-xs-12 col-sm-2">{:__('Shop_id')}:</label>
|
<label class="control-label col-xs-12 col-sm-2">{:__('Shop_id')}:</label>
|
||||||
<div class="col-xs-12 col-sm-8">
|
<div class="col-xs-12 col-sm-8">
|
||||||
<input id="c-shop_id" data-rule="required" data-source="dyqc/manystore_shop/index" class="form-control selectpage" name="row[shop_id]" type="text" value="{$row.shop_id|htmlentities}">
|
<input id="c-shop_id" data-rule="required" data-source="dyqc/manystore_shop/index" class="form-control selectpage" name="row[shop_id]" type="text" value="{$row.shop_id|htmlentities}">
|
||||||
|
|
||||||
|
|
||||||
|
<span style="color: red">
|
||||||
|
|
||||||
|
(没找到机构则点击按钮创建机构后重新下拉框选机构)
|
||||||
|
<a href="javascript:;" data-url="manystore/index/add" class="btn btn-success btn-changeuser {:$auth->check('manystore/index/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
|
||||||
|
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="form-group">-->
|
<!-- <div class="form-group">-->
|
||||||
|
@ -181,7 +189,7 @@
|
||||||
<div class="col-xs-12 col-sm-8">
|
<div class="col-xs-12 col-sm-8">
|
||||||
<div class="radio">
|
<div class="radio">
|
||||||
{foreach name="addressTypeList" item="vo"}
|
{foreach name="addressTypeList" item="vo"}
|
||||||
<label for="row[address_type]-{$key}"><input data-rule="required" id="row[address_type]-{$key}" name="row[address_type]" type="radio" value="{$key}" {in name="key" value="$row.address_type"}checked{/in} /> {$vo}</label>
|
<label for="row[address_type]-{$key}"><input id="row[address_type]-{$key}" name="row[address_type]" type="radio" value="{$key}" {in name="key" value="$row.address_type"}checked{/in} /> {$vo}</label>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
<span style="color: red">( 如果选独立位置需填写具体位置信息! )</span>
|
<span style="color: red">( 如果选独立位置需填写具体位置信息! )</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
|
<label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
|
||||||
<div class="col-xs-12 col-sm-8">
|
<div class="col-xs-12 col-sm-8">
|
||||||
<input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="mobile" data-format-item="{id} - {nickname} - {mobile}" class="form-control selectpage" name="row[user_id]" type="text" value="">
|
<input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="mobile" data-format-item="{id} - {nickname} - {mobile}" class="form-control selectpage" name="row[user_id]" type="text" value="{$q_user_id}">
|
||||||
<span style="color: red">
|
<span style="color: red">
|
||||||
|
|
||||||
(没找到用户则点击按钮创建用户后重新下拉框选用户)
|
(没找到用户则点击按钮创建用户后重新下拉框选用户)
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
|
<label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
|
||||||
<div class="col-xs-12 col-sm-8">
|
<div class="col-xs-12 col-sm-8">
|
||||||
<input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="mobile" data-format-item="{id} - {nickname} - {mobile}" class="form-control selectpage" name="row[user_id]" type="text" value="">
|
<input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="mobile" data-format-item="{id} - {nickname} - {mobile}" class="form-control selectpage" name="row[user_id]" type="text" value="{$q_user_id}">
|
||||||
<span style="color: red">
|
<span style="color: red">
|
||||||
|
|
||||||
(没找到用户则点击按钮创建用户后重新下拉框选用户)
|
(没找到用户则点击按钮创建用户后重新下拉框选用户)
|
||||||
|
|
|
@ -70,8 +70,9 @@ class Index extends Api
|
||||||
"site_city"=>config('site.the_city'),
|
"site_city"=>config('site.the_city'),
|
||||||
"site_timezone"=>config('site.timezone'),
|
"site_timezone"=>config('site.timezone'),
|
||||||
];
|
];
|
||||||
|
$upload_config = config('upload');
|
||||||
|
|
||||||
$this->success('',["base_info"=>$base_info,"home_data"=>$home_data]);
|
$this->success('',["upload_config"=>$upload_config,"base_info"=>$base_info,"home_data"=>$home_data]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ use app\common\controller\Api;
|
||||||
use app\common\library\Ems;
|
use app\common\library\Ems;
|
||||||
use app\common\library\Sms;
|
use app\common\library\Sms;
|
||||||
use app\common\model\dyqc\ManystoreShop;
|
use app\common\model\dyqc\ManystoreShop;
|
||||||
|
use app\common\model\manystore\UserAuth;
|
||||||
use fast\Random;
|
use fast\Random;
|
||||||
use think\Cache;
|
use think\Cache;
|
||||||
use think\Config;
|
use think\Config;
|
||||||
|
@ -504,4 +505,11 @@ class User extends Api
|
||||||
$this->error($this->auth->getError());
|
$this->error($this->auth->getError());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace app\api\controller;
|
namespace app\api\controller;
|
||||||
|
|
||||||
|
use addons\epay\library\Service;
|
||||||
use app\common\controller\Api;
|
use app\common\controller\Api;
|
||||||
use app\common\model\style\HomeImages;
|
use app\common\model\style\HomeImages;
|
||||||
|
|
||||||
|
@ -10,7 +11,7 @@ use app\common\model\style\HomeImages;
|
||||||
*/
|
*/
|
||||||
class WechatUtil extends Api
|
class WechatUtil extends Api
|
||||||
{
|
{
|
||||||
protected $noNeedLogin = ['scheme'];
|
protected $noNeedLogin = ['scheme','link',"codeunlimit"];
|
||||||
protected $noNeedRight = ['*'];
|
protected $noNeedRight = ['*'];
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,11 +29,14 @@ class WechatUtil extends Api
|
||||||
* @ApiSummary(微信小程序生成url-scheme)
|
* @ApiSummary(微信小程序生成url-scheme)
|
||||||
* @ApiRoute(/api/wechat_util/scheme)
|
* @ApiRoute(/api/wechat_util/scheme)
|
||||||
* @ApiMethod(POST)
|
* @ApiMethod(POST)
|
||||||
* @ApiParams (name="id", type="integer", required=true, description="会员ID")
|
* @ApiParams (name="path", type="string", required=false, description="通过 scheme 码进入的小程序页面路径,必须是已经发布的小程序存在的页面,不可携带 query。path 为空时会跳转小程序主页。")
|
||||||
* @ApiParams (name="name", type="string", required=true, description="用户名")
|
* @ApiParams (name="query", type="string", required=false, description="通过 scheme 码进入小程序时的 query,最大1024个字符,只支持数字,大小写英文以及部分特殊字符")
|
||||||
* @ApiParams (name="data", type="object", sample="{'user_id':'int','user_name':'string','profile':{'email':'string','age':'integer'}}", description="扩展数据")
|
* @ApiParams (name="env_version", type="string",required=false , description="默认值release。要打开的小程序版本。正式版为release,体验版为trial,开发版为develop,仅在微信外打开时生效。")
|
||||||
|
* @ApiParams (name="expire_time", type="number",required=false , description="到期失效的 scheme 码的失效时间,为 Unix 时间戳。生成的到期失效 scheme 码在该时间前有效。最长有效期为30天。is_expire 为 true 且 expire_type 为 0 时必填")
|
||||||
|
* @ApiParams (name="expire_type", type="number",required=false , description="默认值0,到期失效的 scheme 码失效类型,失效时间:0,失效间隔天数:1")
|
||||||
|
* @ApiParams (name="expire_interval", type="number",required=false , description="到期失效的 scheme 码的失效间隔天数。生成的到期失效 scheme 码在该间隔时间到达前有效。最长间隔天数为30天。is_expire 为 true 且 expire_type 为 1 时必填")
|
||||||
* @ApiReturnParams (name="code", type="integer", required=true, sample="0")
|
* @ApiReturnParams (name="code", type="integer", required=true, sample="0")
|
||||||
* @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
|
* @ApiReturnParams (name="openlink", type="string", required=true, sample="生成的小程序 scheme 码")
|
||||||
* @ApiReturn({
|
* @ApiReturn({
|
||||||
"code" => 1,
|
"code" => 1,
|
||||||
"msg" => "获取成功",
|
"msg" => "获取成功",
|
||||||
|
@ -40,26 +44,151 @@ class WechatUtil extends Api
|
||||||
*})
|
*})
|
||||||
*/
|
*/
|
||||||
public function scheme() {
|
public function scheme() {
|
||||||
|
$q_params = [];
|
||||||
|
$path = $this->request->post('path/s','');
|
||||||
|
$query = $this->request->post('query/s','');
|
||||||
|
$env_version = $this->request->post('env_version/s','release');
|
||||||
|
$expire_time = $this->request->post('expire_time/d',0);
|
||||||
|
$expire_type = $this->request->post('expire_type/d',0);
|
||||||
|
$expire_interval = $this->request->post('expire_interval/d',0);
|
||||||
|
$jump_wxa = compact('env_version');
|
||||||
|
if($path)$jump_wxa["path"] = $path;
|
||||||
|
if($query)$jump_wxa["query"] = $query;
|
||||||
|
if($expire_time)$q_params["expire_time"] = $expire_time;
|
||||||
|
if($expire_interval)$q_params["expire_interval"] = $expire_interval;
|
||||||
|
$q_params["expire_type"] = $expire_type;
|
||||||
|
$q_params["jump_wxa"] = $jump_wxa;
|
||||||
|
|
||||||
$home_data = [];
|
|
||||||
$home_data['top_image'] = [
|
|
||||||
'type' => config('site.home_top_type'),
|
|
||||||
'image' => cdnurl(config('site.home_top_image'), true),
|
|
||||||
'url' => config('site.home_top_url'),
|
|
||||||
];
|
|
||||||
//首页轮播图
|
|
||||||
$home_data['top_images'] = HomeImages::allList(1, 20);
|
|
||||||
$base_info = [
|
|
||||||
"site_name"=>config('site.name'),
|
|
||||||
// "site_logo"=>cdnurl(config('site.logo'), true),
|
|
||||||
"site_beian"=>config('site.beian'),
|
|
||||||
"site_version"=>''.config('site.version'),
|
|
||||||
"site_city"=>config('site.the_city'),
|
|
||||||
"site_timezone"=>config('site.timezone'),
|
|
||||||
];
|
|
||||||
|
|
||||||
$this->success('',["base_info"=>$base_info,"home_data"=>$home_data]);
|
|
||||||
|
try {
|
||||||
|
// 实例对应的接口对象
|
||||||
|
$scheme = new \WeMini\Scheme(Service::wechatConfig());
|
||||||
|
$res= $scheme->create($q_params);
|
||||||
|
|
||||||
|
} catch (\Exception $e){
|
||||||
|
// Log::log($e->getMessage());
|
||||||
|
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
|
||||||
|
}
|
||||||
|
$this->success('生成成功', $res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ApiTitle(微信小程序生成url-link)
|
||||||
|
* @ApiSummary(微信小程序生成url-link)
|
||||||
|
* @ApiRoute(/api/wechat_util/link)
|
||||||
|
* @ApiMethod(POST)
|
||||||
|
* @ApiParams (name="path", type="string", required=false, description="通过 URL Link 进入的小程序页面路径,必须是已经发布的小程序存在的页面,不可携带 query 。path 为空时会跳转小程序主页")
|
||||||
|
* @ApiParams (name="query", type="string", required=false, description="通过 scheme 码进入小程序时的 query,最大1024个字符,只支持数字,大小写英文以及部分特殊字符")
|
||||||
|
* @ApiParams (name="env_version", type="string",required=false , description="默认值release。要打开的小程序版本。正式版为release,体验版为trial,开发版为develop,仅在微信外打开时生效。")
|
||||||
|
* @ApiParams (name="expire_time", type="number",required=false , description="到期失效的 scheme 码的失效时间,为 Unix 时间戳。生成的到期失效 scheme 码在该时间前有效。最长有效期为30天。is_expire 为 true 且 expire_type 为 0 时必填")
|
||||||
|
* @ApiParams (name="expire_type", type="number",required=false , description="默认值0,到期失效的 scheme 码失效类型,失效时间:0,失效间隔天数:1")
|
||||||
|
* @ApiParams (name="cloud_env", type="string",required=false , description="云开发静态网站自定义 H5 配置参数: 云开发环境")
|
||||||
|
* @ApiParams (name="cloud_domain", type="string",required=false , description="云开发静态网站自定义 H5 配置参数: 静态网站自定义域名,不填则使用默认域名")
|
||||||
|
* @ApiParams (name="cloud_path", type="string",required=false , description="云开发静态网站自定义 H5 配置参数: 云开发静态网站 H5 页面路径,不可携带 query")
|
||||||
|
* @ApiParams (name="cloud_query", type="string",required=false , description="云开发静态网站自定义 H5 配置参数: 云开发静态网站 H5 页面 query 参数,最大 1024 个字符,只支持数字,大小写英文以及部分特殊字符")
|
||||||
|
* @ApiParams (name="cloud_resource_appid", type="string",required=false , description="云开发静态网站自定义 H5 配置参数: 第三方批量代云开发时必填,表示创建该 env 的 appid (小程序/第三方平台)")
|
||||||
|
* @ApiReturnParams (name="code", type="integer", required=true, sample="0")
|
||||||
|
* @ApiReturnParams (name="url_link", type="string", required=true, sample="生成的小程序 URL Link")
|
||||||
|
* @ApiReturn({
|
||||||
|
"code" => 1,
|
||||||
|
"msg" => "获取成功",
|
||||||
|
"data" => {}
|
||||||
|
*})
|
||||||
|
*/
|
||||||
|
public function link() {
|
||||||
|
$q_params = [];
|
||||||
|
$path = $this->request->post('path/s','');
|
||||||
|
$query = $this->request->post('query/s','');
|
||||||
|
$env_version = $this->request->post('env_version/s','release');
|
||||||
|
$expire_time = $this->request->post('expire_time/d',0);
|
||||||
|
$expire_type = $this->request->post('expire_type/d',0);
|
||||||
|
$expire_interval = $this->request->post('expire_interval/d',0);
|
||||||
|
$cloud_env = $this->request->post('cloud_env/s',0);
|
||||||
|
$cloud_domain = $this->request->post('cloud_domain/s',0);
|
||||||
|
$cloud_path = $this->request->post('cloud_path/s',0);
|
||||||
|
$cloud_query = $this->request->post('cloud_query/s',0);
|
||||||
|
$cloud_resource_appid = $this->request->post('cloud_resource_appid/s',0);
|
||||||
|
|
||||||
|
$cloud_base = [];
|
||||||
|
if($cloud_env)$cloud_base["env"] = $cloud_env;
|
||||||
|
if($cloud_domain)$cloud_base["domain"] = $cloud_domain;
|
||||||
|
if($cloud_path)$cloud_base["path"] = $cloud_path;
|
||||||
|
if($cloud_query)$cloud_base["cloud_query"] = $cloud_query;
|
||||||
|
if($cloud_resource_appid)$cloud_base["resource_appid"] = $cloud_resource_appid;
|
||||||
|
|
||||||
|
if($path)$q_params["path"] = $path;
|
||||||
|
if($query)$q_params["query"] = $query;
|
||||||
|
if($env_version)$q_params["env_version"] = $env_version;
|
||||||
|
|
||||||
|
|
||||||
|
if($expire_time)$q_params["expire_time"] = $expire_time;
|
||||||
|
if($expire_interval)$q_params["expire_interval"] = $expire_interval;
|
||||||
|
if($expire_type)$q_params["expire_type"] = $expire_type;
|
||||||
|
if($cloud_base)$q_params["cloud_base"] = $cloud_base;
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 实例对应的接口对象
|
||||||
|
$scheme = new \WeMini\Scheme(Service::wechatConfig());
|
||||||
|
$res= $scheme->urlLink($q_params);
|
||||||
|
|
||||||
|
} catch (\Exception $e){
|
||||||
|
// Log::log($e->getMessage());
|
||||||
|
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
|
||||||
|
}
|
||||||
|
$this->success('生成成功', $res);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ApiTitle(获取不限制的小程序码(太阳码))
|
||||||
|
* @ApiSummary(获取不限制的小程序码(太阳码))
|
||||||
|
* @ApiRoute(/api/wechat_util/codeunlimit)
|
||||||
|
* @ApiMethod(POST)
|
||||||
|
* @ApiParams (name="page", type="string", required=false, description="默认是主页,页面 page,例如 pages/index/index,根路径前不要填加 /,不能携带参数(参数请放在scene字段里),如果不填写这个字段,默认跳主页面。scancode_time为系统保留参数,不允许配置")
|
||||||
|
* @ApiParams (name="scene", type="string", required=false, description="最大32个可见字符,只支持数字,大小写英文以及部分特殊字符:!#$&'()*+,/:;=?@-._~,其它字符请自行编码为合法字符(因不支持%,中文无法使用 urlencode 处理,请使用其他编码方式)")
|
||||||
|
* @ApiParams (name="env_version", type="string",required=false , description="默认值release。要打开的小程序版本。正式版为release,体验版为trial,开发版为develop,仅在微信外打开时生效。")
|
||||||
|
* @ApiParams (name="check_path", type="bool",required=false , description="默认是true,检查page 是否存在,为 true 时 page 必须是已经发布的小程序存在的页面(否则报错);为 false 时允许小程序未发布或者 page 不存在, 但page 有数量上限(60000个)请勿滥用。")
|
||||||
|
* @ApiParams (name="width", type="number",required=false , description="默认430,二维码的宽度,单位 px,最小 280px,最大 1280px")
|
||||||
|
* @ApiParams (name="auto_color", type="bool",required=false , description="自动配置线条颜色,如果颜色依然是黑色,则说明不建议配置主色调,默认 false")
|
||||||
|
* @ApiParams (name="line_color", type="json",required=false , description="默认是{’r’:0,’g’:0,’b’:0} 。auto_color 为 false 时生效,使用 rgb 设置颜色 例如 {’r’:’xxx’,’g’:’xxx’,’b’:’xxx’} 十进制表示")
|
||||||
|
* @ApiParams (name="is_hyaline", type="bool",required=false , description="默认是false,是否需要透明底色,为 true 时,生成透明底色的小程序")
|
||||||
|
* @ApiReturn({
|
||||||
|
"code" => 1,
|
||||||
|
"msg" => "获取成功",
|
||||||
|
"data" => {}
|
||||||
|
*})
|
||||||
|
*/
|
||||||
|
public function codeunlimit() {
|
||||||
|
|
||||||
|
$page = $this->request->post('page/s','');
|
||||||
|
$scene = $this->request->post('scene/s','');
|
||||||
|
$env_version = $this->request->post('env_version/s','release');
|
||||||
|
$check_path = $this->request->post('check_path/d',1);
|
||||||
|
$width = $this->request->post('width/d',430);
|
||||||
|
$auto_color = $this->request->post('auto_color/d',0);
|
||||||
|
$line_color = $this->request->post('line_color/s',0);
|
||||||
|
$is_hyaline = $this->request->post('is_hyaline/d',1);
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 实例对应的接口对象
|
||||||
|
$res = \bw\Common::getMiniappCode($scene, $page, $width, $auto_color ? true : false, $line_color, $is_hyaline ? true : false, null, $check_path ? true : false, $env_version,false);
|
||||||
|
} catch (\Exception $e){
|
||||||
|
// Log::log($e->getMessage());
|
||||||
|
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
|
||||||
|
}
|
||||||
|
$this->success('生成成功', $res);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ use app\common\model\dyqc\ManystoreShop;
|
||||||
*/
|
*/
|
||||||
class Shop extends Base
|
class Shop extends Base
|
||||||
{
|
{
|
||||||
protected $noNeedLogin = ["detail",'people','spec'];
|
protected $noNeedLogin = ["detail",'people','spec','shop_list'];
|
||||||
protected $noNeedRight = '*';
|
protected $noNeedRight = '*';
|
||||||
|
|
||||||
protected $model = null;
|
protected $model = null;
|
||||||
|
@ -161,4 +161,77 @@ class Shop 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 = "user_id", type = "int",required=false,description = "主讲师用户id")
|
||||||
|
* @ApiParams(name = "shop_id", type = "int",required=false,description = "机构店铺id")
|
||||||
|
* @ApiParams(name = "teacher_id", type = "int",required=false,description = "老师id")
|
||||||
|
* @ApiParams(name = "keyword", type = "string",required=false,description = "关键字搜索")
|
||||||
|
* @ApiParams(name = "type", type = "string",required=false,description = "类型:1=个人,2=机构")
|
||||||
|
* @ApiParams(name = "province", type = "string",required=false,description = "省编号")
|
||||||
|
* @ApiParams(name = "city", type = "string",required=false,description = "市编号")
|
||||||
|
* @ApiParams(name = "district", type = "string",required=false,description = "县区编号")
|
||||||
|
* @ApiParams(name = "status", type = "string",required=false,description = "不传则默认查上架的 审核状态:0=待审核,1=审核通过,2=审核失败")
|
||||||
|
* @ApiParams(name = "order", type = "string",required=false,description = " normal=综合排序優先,distance=距离优先")
|
||||||
|
* @ApiParams(name = "nearby", type = "string",required=false,description = "限制最大搜索距离(米)")
|
||||||
|
* @ApiParams(name = "latitude", type = "string",required=false,description = "latitude")
|
||||||
|
* @ApiParams(name = "longitude", type = "string",required=false,description = "longitude")
|
||||||
|
* @ApiReturn({
|
||||||
|
*
|
||||||
|
*})
|
||||||
|
*/
|
||||||
|
public function shop_list()
|
||||||
|
{
|
||||||
|
$user_id = 0;
|
||||||
|
$user = $this->auth->getUser();//登录用户
|
||||||
|
if($user)$user_id = $user['id'];
|
||||||
|
$params =[];
|
||||||
|
$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["user_id"] = $this->request->get('user_id/d', ''); //主讲师用户id
|
||||||
|
$params["id"] = $this->request->get('shop_id/d', ''); //机构店铺id
|
||||||
|
$params["teacher_id"] = $this->request->get('teacher_id/d', ''); //机构店铺id
|
||||||
|
$params["keyword"] = $this->request->get('keyword/s', ''); //机构店铺id
|
||||||
|
$params["type"] = $this->request->get('type/s', ''); //机构店铺id
|
||||||
|
$params["province"] = $this->request->get('province/s', ''); //机构店铺id
|
||||||
|
|
||||||
|
$params["city"] = $this->request->get('city/s', ''); //机构店铺id
|
||||||
|
$params["district"] = $this->request->get('district/s', ''); //机构店铺id
|
||||||
|
$params["status"] = $this->request->get('status/s', ''); //机构店铺id
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$params["order"] = $this->request->get('order/s', ''); //机构店铺id
|
||||||
|
$params["nearby"] = $this->request->get('nearby/s', ''); //机构店铺id
|
||||||
|
|
||||||
|
|
||||||
|
$params["latitude"] = $this->request->get('latitude/s', ''); //机构店铺id
|
||||||
|
$params["longitude"] = $this->request->get('longitude/s', ''); //机构店铺id
|
||||||
|
|
||||||
|
// $type = $this->request->get('type/s', ''); //筛选学员和教练单
|
||||||
|
|
||||||
|
try{
|
||||||
|
//当前申请状态
|
||||||
|
$res = $this->model::getVaildList($params);
|
||||||
|
// if($user_id =='670153'){
|
||||||
|
// file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
|
||||||
|
// }
|
||||||
|
}catch (\Exception $e){
|
||||||
|
|
||||||
|
$this->error($e->getMessage());
|
||||||
|
}
|
||||||
|
$this->success('查询成功', ["list"=>$res]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,132 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\api\controller\school;
|
||||||
|
|
||||||
|
use app\common\model\manystore\UserAuth as UserAuthModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户机构授权接口
|
||||||
|
*/
|
||||||
|
class UserAuth extends Base
|
||||||
|
{
|
||||||
|
protected $noNeedLogin = [];
|
||||||
|
protected $noNeedRight = '*';
|
||||||
|
|
||||||
|
protected $model = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化操作
|
||||||
|
* @access protected
|
||||||
|
*/
|
||||||
|
protected function _initialize()
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->model = new UserAuthModel;
|
||||||
|
parent::_initialize();
|
||||||
|
|
||||||
|
//判断登录用户是否是员工
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ApiTitle(我的授权详情)
|
||||||
|
* @ApiSummary(我的授权详情)
|
||||||
|
* @ApiMethod(GET)
|
||||||
|
* @ApiParams(name = "id", type = "int",required=true,description = "授权id")
|
||||||
|
* @ApiReturn({
|
||||||
|
*
|
||||||
|
*})
|
||||||
|
*/
|
||||||
|
public function detail(){
|
||||||
|
$id = $this->request->get('id/d','');
|
||||||
|
|
||||||
|
if(empty($id)){
|
||||||
|
$this->error(__('缺少必要参数'));
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$res = $this->model->detail($id);
|
||||||
|
} catch (\Exception $e){
|
||||||
|
// Log::log($e->getMessage());
|
||||||
|
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
|
||||||
|
}
|
||||||
|
$this->success('获取成功', ['detail' => $res]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ApiTitle( 我的授权信息列表(取决于搜索条件))
|
||||||
|
* @ApiSummary(我的授权信息列表(取决于搜索条件))
|
||||||
|
* @ApiMethod(GET)
|
||||||
|
* @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=拒绝")
|
||||||
|
* @ApiParams(name = "shop_id", type = "int",required=false,description = "机构店铺id")
|
||||||
|
* @ApiReturn({
|
||||||
|
*
|
||||||
|
*})
|
||||||
|
*/
|
||||||
|
public function auth_list()
|
||||||
|
{
|
||||||
|
$user_id = 0;
|
||||||
|
$user = $this->auth->getUser();//登录用户
|
||||||
|
if($user)$user_id = $user['id'];
|
||||||
|
$params=[];
|
||||||
|
$page = $this->request->get('page/d', 0); //页数
|
||||||
|
$limit = $this->request->get('limit/d', 0); //条数
|
||||||
|
$params['status'] = $this->request->get('status/s', ''); //搜索关键字
|
||||||
|
$params['shop_id'] = $this->request->get('shop_id/d', ''); //搜索关键字
|
||||||
|
$params['user_id'] = $user_id; //搜索关键字
|
||||||
|
|
||||||
|
|
||||||
|
// $type = $this->request->get('type/s', ''); //筛选学员和教练单
|
||||||
|
|
||||||
|
try{
|
||||||
|
//当前申请状态
|
||||||
|
$res = $this->model::allList($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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ApiTitle( 用户机构授权)
|
||||||
|
* @ApiSummary(支持用户主动授权和确认表单两种形式)
|
||||||
|
* @ApiMethod(POST)
|
||||||
|
* @ApiParams(name = "id", type = "int",required=false,description = "非必填,确认表单才需要填")
|
||||||
|
* @ApiParams(name = "shop_id", type = "int",required=true,description = "机构店铺id")
|
||||||
|
* @ApiParams(name = "status", type = "int",required=true,description = "授权操作:1=通过,2=拒绝")
|
||||||
|
* @ApiReturn({
|
||||||
|
*
|
||||||
|
*})
|
||||||
|
*/
|
||||||
|
public function authorization(){
|
||||||
|
$user_id = 0;
|
||||||
|
$user = $this->auth->getUser();//登录用户
|
||||||
|
if($user)$user_id = $user['id'];
|
||||||
|
|
||||||
|
$id = $this->request->post('id/d', 0); //搜索关键字
|
||||||
|
$shop_id = $this->request->post('shop_id/d', 0); //搜索关键字
|
||||||
|
$status = $this->request->post('status/d', 0); //搜索关键字
|
||||||
|
|
||||||
|
try{
|
||||||
|
$res = UserAuth::auth($id,$shop_id,$user_id,$status,'user',$user_id,true);
|
||||||
|
}catch (\Throwable $e){
|
||||||
|
$this->error($e->getMessage());
|
||||||
|
}
|
||||||
|
$this->success('操作成功', $res);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -265,7 +265,7 @@ class HourOrder extends Base
|
||||||
* @ApiParams(name = "page", type = "string",required=true,description = "页数")
|
* @ApiParams(name = "page", type = "string",required=true,description = "页数")
|
||||||
* @ApiParams(name = "limit", type = "string",required=true,description = "条数")
|
* @ApiParams(name = "limit", type = "string",required=true,description = "条数")
|
||||||
* @ApiParams(name = "status", type = "string",required=false,description = "订单状态:-3=已取消,-1=已报名待审核,0=已预约,3=已完成")
|
* @ApiParams(name = "status", type = "string",required=false,description = "订单状态:-3=已取消,-1=已报名待审核,0=已预约,3=已完成")
|
||||||
* @ApiParams(name = "classes_order_id", type = "int",required=false,description = "课程订单id")
|
* @ApiParams(name = "classes_order_id", type = "string",required=false,description = "课程订单id")
|
||||||
* @ApiParams(name = "classes_lib_id", type = "int",required=false,description = "课程id")
|
* @ApiParams(name = "classes_lib_id", type = "int",required=false,description = "课程id")
|
||||||
* @ApiParams(name = "start_time", type = "string",required=false,description = "按开始时间区间查(传值格式:Y/m/d H:M:S-Y/m/d H:M:S)")
|
* @ApiParams(name = "start_time", type = "string",required=false,description = "按开始时间区间查(传值格式:Y/m/d H:M:S-Y/m/d H:M:S)")
|
||||||
* @ApiParams(name = "createtime", type = "string",required=false,description = "按创建时间区间查(传值格式:Y/m/d H:M:S-Y/m/d H:M:S)")
|
* @ApiParams(name = "createtime", type = "string",required=false,description = "按创建时间区间查(传值格式:Y/m/d H:M:S-Y/m/d H:M:S)")
|
||||||
|
@ -295,6 +295,7 @@ class HourOrder extends Base
|
||||||
try{
|
try{
|
||||||
//当前申请状态
|
//当前申请状态
|
||||||
$res = $this->model::workList($page, $limit,$keywords,$status,$classes_order_id,0,$this->classes_lib_ids,$classes_lib_ids,$start_time,$createtime);
|
$res = $this->model::workList($page, $limit,$keywords,$status,$classes_order_id,0,$this->classes_lib_ids,$classes_lib_ids,$start_time,$createtime);
|
||||||
|
// var_dump($this->model->getLastSql());die;
|
||||||
// if($user_id =='670153'){
|
// if($user_id =='670153'){
|
||||||
// file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
|
// file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -41,7 +41,7 @@ class Order extends Base
|
||||||
*})
|
*})
|
||||||
*/
|
*/
|
||||||
public function detail(){
|
public function detail(){
|
||||||
$id = $this->request->get('id/d','');
|
$id = $this->request->get('id/s','');
|
||||||
|
|
||||||
if(empty($id)){
|
if(empty($id)){
|
||||||
$this->error(__('缺少必要参数'));
|
$this->error(__('缺少必要参数'));
|
||||||
|
|
|
@ -95,6 +95,21 @@ $classesHooks = [
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//用户事件钩子
|
||||||
|
$userHooks = [
|
||||||
|
'user_auth_need_after' => [ // 发起用户授权
|
||||||
|
'app\\common\\listener\\user\\UserHook'
|
||||||
|
],
|
||||||
|
'user_auth_success_after' => [ // 用户授权机构通过
|
||||||
|
'app\\common\\listener\\user\\UserHook'
|
||||||
|
],
|
||||||
|
'user_auth_fail_after' => [ // 用户授权机构不通过
|
||||||
|
'app\\common\\listener\\user\\UserHook'
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
//if (file_exists(ROOT_PATH . 'addons/shopro/listener/commission')) {
|
//if (file_exists(ROOT_PATH . 'addons/shopro/listener/commission')) {
|
||||||
// $defaultHooks = array_merge_recursive($defaultHooks, $commissionHooks);
|
// $defaultHooks = array_merge_recursive($defaultHooks, $commissionHooks);
|
||||||
|
@ -102,5 +117,6 @@ $classesHooks = [
|
||||||
$defaultHooks = array_merge_recursive($defaultHooks, $hourHooks);
|
$defaultHooks = array_merge_recursive($defaultHooks, $hourHooks);
|
||||||
$defaultHooks = array_merge_recursive($defaultHooks, $manystoreHooks);
|
$defaultHooks = array_merge_recursive($defaultHooks, $manystoreHooks);
|
||||||
$defaultHooks = array_merge_recursive($defaultHooks, $classesHooks);
|
$defaultHooks = array_merge_recursive($defaultHooks, $classesHooks);
|
||||||
|
$defaultHooks = array_merge_recursive($defaultHooks, $userHooks);
|
||||||
|
|
||||||
return $defaultHooks;
|
return $defaultHooks;
|
||||||
|
|
|
@ -59,7 +59,7 @@ class ClassesHook
|
||||||
}
|
}
|
||||||
|
|
||||||
// 课程审核失败后
|
// 课程审核失败后
|
||||||
public function classesFailNeedAfter(&$params)
|
public function classesAuthFailAfter(&$params)
|
||||||
{
|
{
|
||||||
['classes' => $classes] = $params;
|
['classes' => $classes] = $params;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,86 @@
|
||||||
|
<?php
|
||||||
|
namespace app\common\listener\user;
|
||||||
|
use app\common\model\school\Message;
|
||||||
|
|
||||||
|
class UserHook
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
//发起用户授权
|
||||||
|
public function userAuthNeedAfter(&$params)
|
||||||
|
{
|
||||||
|
['user_auth' => $user_auth,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params;
|
||||||
|
|
||||||
|
// //课程推送给老师
|
||||||
|
// $desc = "您的新课程{$classes['title']}已审核通过,可以在后台操作课程上架!";
|
||||||
|
//
|
||||||
|
// $title = "新课程审核成功";
|
||||||
|
// $mini_type = "classes_apply";
|
||||||
|
// $to_type="user";
|
||||||
|
// $to_id = $classes["user_id"];
|
||||||
|
// $status ="classes";
|
||||||
|
// $platform="user";
|
||||||
|
// $oper_id=0;
|
||||||
|
// $oper_type="system";
|
||||||
|
// $params=[
|
||||||
|
// "event"=>"classes_auth_success_after",
|
||||||
|
// "classes_lib_id"=>$classes["id"],
|
||||||
|
// ];
|
||||||
|
// Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 用户授权机构通过
|
||||||
|
public function userAuthSuccessAfter(&$params)
|
||||||
|
{
|
||||||
|
['user_auth' => $user_auth,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params;
|
||||||
|
|
||||||
|
// //课程推送给老师
|
||||||
|
// $desc = "您的新课程{$classes['title']}已审核通过,可以在后台操作课程上架!";
|
||||||
|
//
|
||||||
|
// $title = "新课程审核成功";
|
||||||
|
// $mini_type = "classes_apply";
|
||||||
|
// $to_type="user";
|
||||||
|
// $to_id = $classes["user_id"];
|
||||||
|
// $status ="classes";
|
||||||
|
// $platform="user";
|
||||||
|
// $oper_id=0;
|
||||||
|
// $oper_type="system";
|
||||||
|
// $params=[
|
||||||
|
// "event"=>"classes_auth_success_after",
|
||||||
|
// "classes_lib_id"=>$classes["id"],
|
||||||
|
// ];
|
||||||
|
// Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 用户授权机构不通过
|
||||||
|
public function userAuthFailAfter(&$params)
|
||||||
|
{
|
||||||
|
['user_auth' => $user_auth,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params;
|
||||||
|
|
||||||
|
//
|
||||||
|
// //课程推送给老师
|
||||||
|
// $desc = "您的新课程{$classes['title']}审核未通过,未通过原因为:{$classes['reason']},整改后,可以在后台重新提交!";
|
||||||
|
//
|
||||||
|
// $title = "新课程审核不通过";
|
||||||
|
// $mini_type = "classes_apply";
|
||||||
|
// $to_type="user";
|
||||||
|
// $to_id = $classes["user_id"];
|
||||||
|
// $status ="classes";
|
||||||
|
// $platform="user";
|
||||||
|
// $oper_id=0;
|
||||||
|
// $oper_type="system";
|
||||||
|
// $params=[
|
||||||
|
// "event"=>"classes_auth_success_after",
|
||||||
|
// "classes_lib_id"=>$classes["id"],
|
||||||
|
// ];
|
||||||
|
// Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -178,6 +178,11 @@ class ManystoreShop extends BaseModel
|
||||||
return $this->belongsTo('app\admin\model\Admin', 'admin_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
return $this->belongsTo('app\admin\model\Admin', 'admin_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
return $this->belongsTo('app\common\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function checkFull($id){
|
public function checkFull($id){
|
||||||
$self = $this->get($id,['teachers']);
|
$self = $this->get($id,['teachers']);
|
||||||
|
@ -523,6 +528,120 @@ public static function getAuthInfo($user_id){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有课程列表
|
||||||
|
*/
|
||||||
|
public static function getVaildList($params) {
|
||||||
|
extract($params);
|
||||||
|
$a = (new self)->getWithAlisaName().'.';
|
||||||
|
// 查询自提点
|
||||||
|
if(isset($status) && in_array($status, [1,2,0])){
|
||||||
|
$selfetch = self::with(['user']);
|
||||||
|
}else{
|
||||||
|
$selfetch = self::with(['user'])->where($a.'status', '1')->where("{$a}auth_status",1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$order = $order?? 'normal';
|
||||||
|
$per_page = $limit ?? 10;
|
||||||
|
|
||||||
|
|
||||||
|
$field = "{$a}id,{$a}name,{$a}user_id,{$a}logo,{$a}image,{$a}images,{$a}address_city,{$a}city,{$a}province,{$a}district,{$a}address,{$a}address_detail,{$a}longitude,{$a}latitude,{$a}type,{$a}tel,{$a}status,{$a}create_time,{$a}update_time,{$a}weigh";
|
||||||
|
|
||||||
|
//得到距离
|
||||||
|
if (isset($latitude) && isset($longitude) && $latitude && $longitude) {
|
||||||
|
$field .= ', '.getDistanceBuilder($latitude, $longitude);
|
||||||
|
}else{
|
||||||
|
$field .= ', 0 as distance';
|
||||||
|
}
|
||||||
|
|
||||||
|
//得到每个
|
||||||
|
|
||||||
|
|
||||||
|
$selfetch = $selfetch->field($field);
|
||||||
|
if (isset($keyword) && $keyword) {
|
||||||
|
$selfetch = $selfetch->where("{$a}name|{$a}address|{$a}address_detail|{$a}address_city", 'like', '%' . $keyword . '%');
|
||||||
|
}
|
||||||
|
|
||||||
|
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 (isset($id) && $id) {
|
||||||
|
$selfetch = $selfetch->where("{$a}id", 'in', ''.$id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (isset($teacher_id) && $teacher_id) {
|
||||||
|
$teacher = Teacher::where("id",$teacher_id)->find();
|
||||||
|
if($teacher){
|
||||||
|
$selfetch = $selfetch->where("{$a}id", 'in', ''.$teacher["shop_id"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($type) && $type) {
|
||||||
|
$selfetch = $selfetch->where("{$a}type", 'in', ''.$type);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($status) && $status) {
|
||||||
|
$selfetch = $selfetch->where("{$a}status", 'in', ''.$status);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//区域搜索
|
||||||
|
if (isset($province) && $province) {
|
||||||
|
$selfetch = $selfetch->where("{$a}province", 'in', ''.$province);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (isset($city) && $city) {
|
||||||
|
$selfetch = $selfetch->where("{$a}city", 'in', ''.$city);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($district) && $district) {
|
||||||
|
$selfetch = $selfetch->where("{$a}district", 'in', ''.$district);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//排序
|
||||||
|
switch ($order) {
|
||||||
|
case "normal": //综合排序(推薦優先)
|
||||||
|
$selfetch = $selfetch->order("{$a}weigh desc,{$a}id desc");
|
||||||
|
break;
|
||||||
|
case "distance": //距离优先 权重
|
||||||
|
$selfetch = $selfetch->order("distance asc,{$a}weigh desc,{$a}id desc");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new \Exception("不支持的排序类型");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($nearby) && $nearby) {
|
||||||
|
$selfetch = $selfetch->having("distance <= {$nearby}");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$selfetch = $selfetch->paginate($per_page);
|
||||||
|
|
||||||
|
//额外附加数据
|
||||||
|
// foreach ($selfetch as $row) { //迭代器魔术方法遍历,填值自动引用传值
|
||||||
|
// //设置是否已收藏
|
||||||
|
// $row->is_collect = in_array($row->id,$collect_classes_lib_ids) ? 1 : 0;
|
||||||
|
// }
|
||||||
|
|
||||||
|
return $selfetch;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,12 @@
|
||||||
|
|
||||||
namespace app\common\model\manystore;
|
namespace app\common\model\manystore;
|
||||||
|
|
||||||
|
use app\common\model\BaseModel;
|
||||||
|
use app\common\model\User;
|
||||||
use think\Model;
|
use think\Model;
|
||||||
|
|
||||||
|
|
||||||
class UserAuth extends Model
|
class UserAuth extends BaseModel
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
@ -80,4 +82,200 @@ class UserAuth extends Model
|
||||||
{
|
{
|
||||||
return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function authcheck($shop_id,$user_id){
|
||||||
|
$usercheck = UserAuth::where("user_id",$user_id)
|
||||||
|
->where("shop_id",$shop_id)
|
||||||
|
->where("status",1)->find();
|
||||||
|
if(!$usercheck) return false;
|
||||||
|
return $usercheck;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**用户授权机构
|
||||||
|
* @param $id
|
||||||
|
* @param int $user_id
|
||||||
|
* @param int $status 授权状态:0=待确认,1=通过,2=拒绝
|
||||||
|
* @param bool $check
|
||||||
|
* @param bool $trans
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
|
public static function auth($id,$shop_id,$user_id,$status,$oper_type='user',$oper_id=0,$trans=false){
|
||||||
|
|
||||||
|
$create = false;
|
||||||
|
if($id){
|
||||||
|
$classes_lib = self::where("id",$id)->where("status","in",[0,2])->find();
|
||||||
|
if(!$classes_lib)throw new \Exception("找不到待授权记录!");
|
||||||
|
}
|
||||||
|
if($shop_id && $user_id){
|
||||||
|
$shop_info = Shop::get($shop_id);
|
||||||
|
if(!$shop_info)throw new \Exception("找不到店铺!");
|
||||||
|
$classes_lib = self::where("shop_id",$shop_id)->where("user_id",$user_id)->find();
|
||||||
|
if(!$classes_lib){
|
||||||
|
$create = true;
|
||||||
|
}else{
|
||||||
|
if(!in_array($classes_lib["status"],[0,2]))throw new \Exception("已授权!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$create && !$classes_lib)throw new \Exception("找不到待授权记录!缺失必要参数!");
|
||||||
|
|
||||||
|
if($user_id){
|
||||||
|
$user_info = User::get($user_id);
|
||||||
|
if(!$user_info)throw new \Exception("找不到用户!");
|
||||||
|
if($classes_lib && $classes_lib["user_id"]!=$user_id)throw new \Exception("用户与授权记录不匹配!");
|
||||||
|
}
|
||||||
|
//判断逻辑
|
||||||
|
if($trans){
|
||||||
|
self::beginTrans();
|
||||||
|
}
|
||||||
|
|
||||||
|
try{
|
||||||
|
|
||||||
|
|
||||||
|
//更新授权记录
|
||||||
|
$data = [
|
||||||
|
"shop_id"=>$shop_id,
|
||||||
|
"user_id"=>$user_id,
|
||||||
|
"status"=>0,
|
||||||
|
];
|
||||||
|
//没创建先创建
|
||||||
|
if($create){
|
||||||
|
$classes_lib = self::create($data);
|
||||||
|
//调用事件
|
||||||
|
$datas = ['user_auth' => $classes_lib,"oper_type"=>$oper_type,"oper_id"=>$oper_id];
|
||||||
|
\think\Hook::listen('user_auth_need_after', $datas);
|
||||||
|
}
|
||||||
|
|
||||||
|
$data["status"] = $status;
|
||||||
|
|
||||||
|
$equa = true;
|
||||||
|
//for循环数据变更检测
|
||||||
|
foreach ($data as $key=>$value){
|
||||||
|
if($value!=$classes_lib[$key]){
|
||||||
|
$equa = false;break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$create && $equa) throw new \Exception("无变更无需更新!");
|
||||||
|
|
||||||
|
//事务逻辑
|
||||||
|
if($status == 1){
|
||||||
|
$classes_lib["status"] = $status;
|
||||||
|
$classes_lib["auth_time"] = time();
|
||||||
|
$classes_lib->save();
|
||||||
|
|
||||||
|
|
||||||
|
//调用事件
|
||||||
|
$datas = ['user_auth' => $classes_lib,"oper_type"=>$oper_type,"oper_id"=>$oper_id];
|
||||||
|
\think\Hook::listen('user_auth_success_after', $datas);
|
||||||
|
|
||||||
|
}elseif($status == 2){
|
||||||
|
//拒绝
|
||||||
|
$classes_lib["status"] = $status;
|
||||||
|
$classes_lib["auth_time"] = time();
|
||||||
|
$classes_lib->save();
|
||||||
|
|
||||||
|
//调用事件
|
||||||
|
$datas = ['user_auth' => $classes_lib,"oper_type"=>$oper_type,"oper_id"=>$oper_id];
|
||||||
|
\think\Hook::listen('user_auth_fail_after', $datas);
|
||||||
|
}else{
|
||||||
|
// throw new \Exception("状态错误!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if($trans){
|
||||||
|
self::commitTrans();
|
||||||
|
}
|
||||||
|
}catch (\Exception $e){
|
||||||
|
if($trans){
|
||||||
|
self::rollbackTrans();
|
||||||
|
}
|
||||||
|
throw new \Exception($e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return $classes_lib;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function detail($id){
|
||||||
|
$self = $this->get($id,["shop"]);
|
||||||
|
$self["shop"]->visible(['name',"logo","image"]);
|
||||||
|
return $self;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**得到基础条件
|
||||||
|
* @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, ['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['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']);
|
||||||
|
|
||||||
|
// if (isset($whereData['keywords'])&&$whereData['keywords']) $model = $model->where("{$alisa}name|{$alisa}id", '=', $whereData['keywords']);
|
||||||
|
if (isset($whereData['time'])&&$whereData['time']){
|
||||||
|
$model = $model->time(['auth_time',$whereData['time']]);
|
||||||
|
}
|
||||||
|
if (isset($whereData['user_id']) && $whereData['user_id']) $model = $model->where("{$alisa}user_id", '=', $whereData['user_id']);
|
||||||
|
|
||||||
|
if (isset($whereData['shop_id']) && $whereData['shop_id']) $model = $model->where("{$alisa}shop_id", 'in', $whereData['shop_id']);
|
||||||
|
|
||||||
|
return $model;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static function allList($page, $limit,$params=[]){
|
||||||
|
$with_field = [
|
||||||
|
'user'=>['nickname','mobile','avatar','realname'],
|
||||||
|
'shop'=>['name','logo','image','images'],
|
||||||
|
'base'=>['*'],
|
||||||
|
];
|
||||||
|
$alisa = (new self)->getWithAlisaName();
|
||||||
|
$sort = "{$alisa}.status asc,{$alisa}.id desc";
|
||||||
|
// if(!empty($params['status'])){
|
||||||
|
// $params['status'] = '1';
|
||||||
|
// }
|
||||||
|
return (new self)->getBaseList($params, $page, $limit,$sort,$with_field);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -526,6 +526,12 @@ $user_unpaid_order = $user_paid_order =null;
|
||||||
$selfetch = $selfetch->where("{$a}user_id", 'in', ''.$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 (isset($teacher_id) && $teacher_id) {
|
if (isset($teacher_id) && $teacher_id) {
|
||||||
$selfetch = $selfetch->where("{$a}teacher_id", 'in', ''.$teacher_id);
|
$selfetch = $selfetch->where("{$a}teacher_id", 'in', ''.$teacher_id);
|
||||||
}
|
}
|
||||||
|
@ -599,7 +605,7 @@ $user_unpaid_order = $user_paid_order =null;
|
||||||
$classes_label_ids = implode("|",explode(',',$classes_label_ids));
|
$classes_label_ids = implode("|",explode(',',$classes_label_ids));
|
||||||
$selfetch = $selfetch->whereRaw(" {$a}classes_label_ids REGEXP '({$classes_label_ids})'");
|
$selfetch = $selfetch->whereRaw(" {$a}classes_label_ids REGEXP '({$classes_label_ids})'");
|
||||||
}
|
}
|
||||||
$collect_classes_lib_ids = [];
|
$collect_classes_lib_ids = [-1];
|
||||||
//需登录查询条件:
|
//需登录查询条件:
|
||||||
if(isset($my_user_id) && $my_user_id){
|
if(isset($my_user_id) && $my_user_id){
|
||||||
//得到我收藏的课程ids
|
//得到我收藏的课程ids
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
namespace app\common\model\school\classes\hourorder;
|
namespace app\common\model\school\classes\hourorder;
|
||||||
|
|
||||||
use app\admin\model\Admin;
|
use app\admin\model\Admin;
|
||||||
|
use app\admin\model\school\classes\Blacklist;
|
||||||
use app\common\model\school\classes\ClassesLib;
|
use app\common\model\school\classes\ClassesLib;
|
||||||
use app\common\model\school\classes\ClassesSpec;
|
use app\common\model\school\classes\ClassesSpec;
|
||||||
use app\common\model\User;
|
use app\common\model\User;
|
||||||
|
@ -911,6 +912,54 @@ class Order extends BaseModel
|
||||||
if($order_info) throw new \Exception("当前时间区间内,您已预约课程{$order_info['detail']['title']},无法再预约其他课程");
|
if($order_info) throw new \Exception("当前时间区间内,您已预约课程{$order_info['detail']['title']},无法再预约其他课程");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//执行免费课黑名单判断
|
||||||
|
//免费课才进行判断
|
||||||
|
if($lib && $lib['feel']=='1'){
|
||||||
|
self::checkBlackList($user_id,true);
|
||||||
|
}
|
||||||
|
|
||||||
|
//过期课时无法下单(结束时间小于等于当前时间)
|
||||||
|
if($classes_lib_spec_info["end_time"] <= time()){
|
||||||
|
throw new \Exception("该课时已过期结束,无法预约!");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//执行免费课黑名单判断
|
||||||
|
public static function checkBlackList($user_id,$check=false){
|
||||||
|
$as = (new self)->getWithAlisaName();
|
||||||
|
//黑名单配置
|
||||||
|
$black_limit = config("site.free_classes_not_verify_num");
|
||||||
|
//如果免费课程报名通过后到结束时间不去核销N次 ,则进入黑名单
|
||||||
|
$order_count = self::with("detail")->where("{$as}.status",'in',["0"])
|
||||||
|
->where("detail.feel",'1')
|
||||||
|
->where("{$as}.user_id",$user_id)
|
||||||
|
->where("{$as}.end_time" ,'<=',time())
|
||||||
|
->count();
|
||||||
|
//已达到进入黑名单条件
|
||||||
|
if($order_count >= $black_limit){
|
||||||
|
$where = [
|
||||||
|
"user_id"=>$user_id
|
||||||
|
];
|
||||||
|
$blacklist = Blacklist::where($where)->find();
|
||||||
|
if(!$blacklist){
|
||||||
|
$blacklist = new Blacklist();
|
||||||
|
}
|
||||||
|
$blacklist->save($where);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if($check){
|
||||||
|
//判断用户是否在黑名单中
|
||||||
|
$where = [
|
||||||
|
"user_id"=>$user_id
|
||||||
|
];
|
||||||
|
$blacklist = Blacklist::where($where)->find();
|
||||||
|
|
||||||
|
if($blacklist)throw new \Exception("您已进入黑名单,无法进行其他免费课时报名!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ return [
|
||||||
/**
|
/**
|
||||||
* 最大可上传大小
|
* 最大可上传大小
|
||||||
*/
|
*/
|
||||||
'maxsize' => '100mb',
|
'maxsize' => '5mb',
|
||||||
/**
|
/**
|
||||||
* 可上传的文件类型
|
* 可上传的文件类型
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -54,6 +54,7 @@ class Attachment extends ManystoreBase
|
||||||
|
|
||||||
$list = $this->model
|
$list = $this->model
|
||||||
->where($mimetypeQuery)
|
->where($mimetypeQuery)
|
||||||
|
->whereRaw("`filename` NOT REGEXP '^[0-9A-Fa-f]{32}'")
|
||||||
->where($where)
|
->where($where)
|
||||||
->order($sort, $order)
|
->order($sort, $order)
|
||||||
->paginate($limit);
|
->paginate($limit);
|
||||||
|
|
|
@ -3,6 +3,13 @@
|
||||||
namespace app\manystore\controller\manystore;
|
namespace app\manystore\controller\manystore;
|
||||||
|
|
||||||
use app\common\controller\ManystoreBase;
|
use app\common\controller\ManystoreBase;
|
||||||
|
use app\common\model\User;
|
||||||
|
use app\manystore\model\Manystore;
|
||||||
|
use think\Db;
|
||||||
|
use think\Exception;
|
||||||
|
use think\exception\PDOException;
|
||||||
|
use think\exception\ValidateException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 授权机构用户
|
* 授权机构用户
|
||||||
|
@ -17,11 +24,14 @@ class UserAuth extends ManystoreBase
|
||||||
* @var \app\manystore\model\manystore\UserAuth
|
* @var \app\manystore\model\manystore\UserAuth
|
||||||
*/
|
*/
|
||||||
protected $model = null;
|
protected $model = null;
|
||||||
|
protected $qSwitch = true;
|
||||||
|
protected $qFields = ["shop_id","user_id"];
|
||||||
|
|
||||||
public function _initialize()
|
public function _initialize()
|
||||||
{
|
{
|
||||||
parent::_initialize();
|
|
||||||
$this->model = new \app\manystore\model\manystore\UserAuth;
|
$this->model = new \app\manystore\model\manystore\UserAuth;
|
||||||
|
parent::_initialize();
|
||||||
|
|
||||||
$this->view->assign("statusList", $this->model->getStatusList());
|
$this->view->assign("statusList", $this->model->getStatusList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,10 +72,19 @@ class UserAuth extends ManystoreBase
|
||||||
foreach ($list as $row) {
|
foreach ($list as $row) {
|
||||||
|
|
||||||
$row->getRelation('manystoreshop')->visible(['name']);
|
$row->getRelation('manystoreshop')->visible(['name']);
|
||||||
$row->getRelation('user')->visible(['nickname','avatar']);
|
$row->getRelation('user')->visible(['nickname','avatar','mobile']);
|
||||||
|
}
|
||||||
|
$rows = $list->items();
|
||||||
|
foreach ($list as $row) {
|
||||||
|
|
||||||
|
if($row["status"]!=1){
|
||||||
|
$row->user->mobile = "需授权通过";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
|
||||||
|
|
||||||
|
$result = array("total" => $list->total(), "rows" => $rows);
|
||||||
|
|
||||||
return json($result);
|
return json($result);
|
||||||
}
|
}
|
||||||
|
@ -101,4 +120,206 @@ class UserAuth extends ManystoreBase
|
||||||
return $this->view->fetch();
|
return $this->view->fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected function updateCheck($id,$params=[],$row=null){
|
||||||
|
|
||||||
|
// 课程存在售后订单则不允许操作
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function update_check(&$params,$row=null)
|
||||||
|
{
|
||||||
|
|
||||||
|
$shop_id = SHOP_ID;
|
||||||
|
$manystore = Manystore::where("shop_id", $shop_id)->find();
|
||||||
|
if (!$manystore) {
|
||||||
|
$this->error("店铺不存在");
|
||||||
|
}
|
||||||
|
// $params["manystore_id"] = $manystore["id"];
|
||||||
|
$params["shop_id"] = $shop_id;
|
||||||
|
$user = User::where("nickname|realname|mobile", $params["user_id"])->find();
|
||||||
|
if(!$user) $this->error("未找到用户请先让用户登录小程序再提交表单");
|
||||||
|
$params["user_id"] = $user["id"];
|
||||||
|
|
||||||
|
$user_id = $params["user_id"];
|
||||||
|
//修改
|
||||||
|
if($row){
|
||||||
|
//用户已是其他的教师(搜索)
|
||||||
|
$teacher_user = $this->model->where("user_id",$user_id)->where("shop_id",$shop_id)->where("id","<>",$row["id"])->find();
|
||||||
|
if($teacher_user){
|
||||||
|
$this->error("已向用户发起过授权申请!");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
//新增
|
||||||
|
//用户已是教师(搜索)
|
||||||
|
$teacher_user = $this->model->where("user_id",$user_id)->where("shop_id",$shop_id)->find();
|
||||||
|
if($teacher_user){
|
||||||
|
$this->error("已向用户发起过授权申请!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @throws \think\Exception
|
||||||
|
*/
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
if ($this->request->isPost()) {
|
||||||
|
$params = $this->request->post("row/a");
|
||||||
|
if ($params) {
|
||||||
|
$params = $this->preExcludeFields($params);
|
||||||
|
|
||||||
|
if($this->storeIdFieldAutoFill && STORE_ID ){
|
||||||
|
$params['store_id'] = STORE_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($this->shopIdAutoCondition && SHOP_ID){
|
||||||
|
$params['shop_id'] = SHOP_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(true)->validate($validate);
|
||||||
|
}
|
||||||
|
$this->update_check($params,$row=null);
|
||||||
|
// $result = $this->model->allowField(true)->save($params);
|
||||||
|
$result = \app\common\model\manystore\UserAuth::auth(0,$params["shop_id"],$params["user_id"],0,'shop',$this->auth->id);
|
||||||
|
|
||||||
|
Db::commit();
|
||||||
|
} catch (ValidateException $e) {
|
||||||
|
Db::rollback();
|
||||||
|
$this->error($e->getMessage());
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
Db::rollback();
|
||||||
|
$this->error($e->getMessage());
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Db::rollback();
|
||||||
|
$this->error($e->getMessage());
|
||||||
|
}
|
||||||
|
if ($result !== false) {
|
||||||
|
$this->success();
|
||||||
|
} else {
|
||||||
|
$this->error(__('No rows were inserted'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->error(__('Parameter %s can not be empty', ''));
|
||||||
|
}
|
||||||
|
return $this->view->fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
*/
|
||||||
|
public function edit($ids = null)
|
||||||
|
{
|
||||||
|
if($this->shopIdAutoCondition){
|
||||||
|
$this->model->where(array('shop_id'=>SHOP_ID));
|
||||||
|
}
|
||||||
|
$row = $this->model->where(array('id'=>$ids))->find();
|
||||||
|
if (!$row) {
|
||||||
|
$this->error(__('No Results were found'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->isPost()) {
|
||||||
|
$params = $this->request->post("row/a");
|
||||||
|
if ($params) {
|
||||||
|
$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(true)->validate($validate);
|
||||||
|
}
|
||||||
|
$this->update_check($params,$row);
|
||||||
|
|
||||||
|
|
||||||
|
// $result = $row->allowField(true)->save($params);
|
||||||
|
Db::commit();
|
||||||
|
} catch (ValidateException $e) {
|
||||||
|
Db::rollback();
|
||||||
|
$this->error($e->getMessage());
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
Db::rollback();
|
||||||
|
$this->error($e->getMessage());
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Db::rollback();
|
||||||
|
$this->error($e->getMessage());
|
||||||
|
}
|
||||||
|
if ($result !== false) {
|
||||||
|
$this->success();
|
||||||
|
} else {
|
||||||
|
$this->error(__('No rows were updated'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->error(__('Parameter %s can not be empty', ''));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$user = User::where("id", $row["user_id"])->find();
|
||||||
|
// if(!$user) $this->error("未找到用户请先让用户登录小程序再提交表单");
|
||||||
|
$row["user_id"] = $user["mobile"]?? ""; //nickname|realname|mobile
|
||||||
|
$this->view->assign("row", $row);
|
||||||
|
return $this->view->fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
public function del($ids = "")
|
||||||
|
{
|
||||||
|
if (!$this->request->isPost()) {
|
||||||
|
$this->error(__("Invalid parameters"));
|
||||||
|
}
|
||||||
|
$ids = $ids ? $ids : $this->request->post("ids");
|
||||||
|
if ($ids) {
|
||||||
|
$pk = $this->model->getPk();
|
||||||
|
if($this->shopIdAutoCondition){
|
||||||
|
$this->model->where(array('shop_id'=>SHOP_ID));
|
||||||
|
}
|
||||||
|
$list = $this->model->where($pk, 'in', $ids)->select();
|
||||||
|
foreach ($list as $item) {
|
||||||
|
$this->updateCheck($item->id);
|
||||||
|
}
|
||||||
|
$count = 0;
|
||||||
|
Db::startTrans();
|
||||||
|
try {
|
||||||
|
foreach ($list as $k => $v) {
|
||||||
|
$count += $v->delete();
|
||||||
|
}
|
||||||
|
Db::commit();
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
Db::rollback();
|
||||||
|
$this->error($e->getMessage());
|
||||||
|
} catch (Exception $e) {
|
||||||
|
Db::rollback();
|
||||||
|
$this->error($e->getMessage());
|
||||||
|
}
|
||||||
|
if ($count) {
|
||||||
|
$this->success();
|
||||||
|
} else {
|
||||||
|
$this->error(__('No rows were deleted'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->error(__('Parameter %s can not be empty', 'ids'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
namespace app\manystore\controller\school\classes;
|
namespace app\manystore\controller\school\classes;
|
||||||
|
|
||||||
use app\common\controller\ManystoreBase;
|
use app\common\controller\ManystoreBase;
|
||||||
|
use app\common\model\manystore\UserAuth;
|
||||||
use app\common\model\User;
|
use app\common\model\User;
|
||||||
use app\manystore\model\Manystore;
|
use app\manystore\model\Manystore;
|
||||||
use think\Db;
|
use think\Db;
|
||||||
|
@ -25,7 +26,7 @@ class Teacher extends ManystoreBase
|
||||||
protected $model = null;
|
protected $model = null;
|
||||||
|
|
||||||
protected $qSwitch = true;
|
protected $qSwitch = true;
|
||||||
protected $qFields = ["manystore_id","shop_id"];
|
protected $qFields = ["manystore_id","shop_id","user_id"];
|
||||||
|
|
||||||
public function _initialize()
|
public function _initialize()
|
||||||
{
|
{
|
||||||
|
@ -102,6 +103,14 @@ class Teacher extends ManystoreBase
|
||||||
$params["shop_id"] = $shop_id;
|
$params["shop_id"] = $shop_id;
|
||||||
$user = User::where("nickname|realname|mobile", $params["user_id"])->find();
|
$user = User::where("nickname|realname|mobile", $params["user_id"])->find();
|
||||||
if(!$user) $this->error("未找到用户请先让用户登录小程序再提交表单");
|
if(!$user) $this->error("未找到用户请先让用户登录小程序再提交表单");
|
||||||
|
|
||||||
|
//如果开启了检测用户授权,则检测用户是否授权
|
||||||
|
if(config("site.shop_auth_user_check")){
|
||||||
|
if(!UserAuth::authcheck($shop_id,$user["id"])) $this->error("用户未授权当前机构!请先让用户授权同意您再操作!");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$params["user_id"] = $user["id"];
|
$params["user_id"] = $user["id"];
|
||||||
|
|
||||||
$user_id = $params["user_id"];
|
$user_id = $params["user_id"];
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
namespace app\manystore\controller\school\classes;
|
namespace app\manystore\controller\school\classes;
|
||||||
|
|
||||||
use app\common\controller\ManystoreBase;
|
use app\common\controller\ManystoreBase;
|
||||||
|
use app\common\model\manystore\UserAuth;
|
||||||
use app\common\model\User;
|
use app\common\model\User;
|
||||||
use app\manystore\model\Manystore;
|
use app\manystore\model\Manystore;
|
||||||
use think\Db;
|
use think\Db;
|
||||||
|
@ -24,7 +25,7 @@ class Verification extends ManystoreBase
|
||||||
*/
|
*/
|
||||||
protected $model = null;
|
protected $model = null;
|
||||||
protected $qSwitch = true;
|
protected $qSwitch = true;
|
||||||
protected $qFields = ["manystore_id","shop_id"];
|
protected $qFields = ["manystore_id","shop_id","user_id"];
|
||||||
|
|
||||||
public function _initialize()
|
public function _initialize()
|
||||||
{
|
{
|
||||||
|
@ -103,6 +104,13 @@ class Verification extends ManystoreBase
|
||||||
$params["shop_id"] = $shop_id;
|
$params["shop_id"] = $shop_id;
|
||||||
$user = User::where("nickname|realname|mobile", $params["user_id"])->find();
|
$user = User::where("nickname|realname|mobile", $params["user_id"])->find();
|
||||||
if(!$user) $this->error("未找到用户请先让用户登录小程序再提交表单");
|
if(!$user) $this->error("未找到用户请先让用户登录小程序再提交表单");
|
||||||
|
|
||||||
|
|
||||||
|
//如果开启了检测用户授权,则检测用户是否授权
|
||||||
|
if(config("site.shop_auth_user_check")){
|
||||||
|
if(!UserAuth::authcheck($shop_id,$user["id"])) $this->error("用户未授权当前机构!请先让用户授权同意您再操作!");
|
||||||
|
}
|
||||||
|
|
||||||
$params["user_id"] = $user["id"];
|
$params["user_id"] = $user["id"];
|
||||||
|
|
||||||
$user_id = $params["user_id"];
|
$user_id = $params["user_id"];
|
||||||
|
|
|
@ -7,6 +7,11 @@ return [
|
||||||
'Status 0' => '待确认',
|
'Status 0' => '待确认',
|
||||||
'Status 1' => '通过',
|
'Status 1' => '通过',
|
||||||
'Status 2' => '拒绝',
|
'Status 2' => '拒绝',
|
||||||
|
'Add' => '添加用户授权申请',
|
||||||
|
'Delete'=>'取消授权',
|
||||||
|
'Del'=>'取消授权',
|
||||||
|
'User.mobile'=>'用户手机号',
|
||||||
|
|
||||||
'Auth_time' => '授权确认时间',
|
'Auth_time' => '授权确认时间',
|
||||||
'Createtime' => '发起时间',
|
'Createtime' => '发起时间',
|
||||||
'Update_time' => '修改时间',
|
'Update_time' => '修改时间',
|
||||||
|
|
|
@ -17,7 +17,7 @@ return [
|
||||||
'Type' => '地点类型',
|
'Type' => '地点类型',
|
||||||
'Type out' => '户外',
|
'Type out' => '户外',
|
||||||
'Type in' => '室内',
|
'Type in' => '室内',
|
||||||
'Classes_num' => '课时数',
|
'Classes_num' => '多少节课',
|
||||||
'Address_type' => '地址类型',
|
'Address_type' => '地址类型',
|
||||||
'Address_type 1' => '按机构',
|
'Address_type 1' => '按机构',
|
||||||
'Address_type 2' => '独立位置',
|
'Address_type 2' => '独立位置',
|
||||||
|
|
|
@ -95,9 +95,9 @@ class ManystoreAuth
|
||||||
}
|
}
|
||||||
// 获取用户需要验证的所有有效规则列表
|
// 获取用户需要验证的所有有效规则列表
|
||||||
$rulelist = $this->getRuleList($uid);
|
$rulelist = $this->getRuleList($uid);
|
||||||
if (in_array('*', $rulelist)) {
|
// if (in_array('*', $rulelist)) {
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (is_string($name)) {
|
if (is_string($name)) {
|
||||||
$name = strtolower($name);
|
$name = strtolower($name);
|
||||||
|
|
|
@ -3,33 +3,38 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
|
<label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
|
||||||
<div class="col-xs-12 col-sm-8">
|
<div class="col-xs-12 col-sm-8">
|
||||||
<input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="">
|
<input id="c-user_id" data-rule="required" class="form-control" name="row[user_id]" type="text" value="{$q_user_id}">
|
||||||
|
<!-- <span style="color: red">(请先让对方登录小程序,之后输入小程序端用户:手机号,昵称 或 姓名 )</span>-->
|
||||||
|
<span style="color: red">
|
||||||
|
(没找到用户则点击按钮创建用户后重新填入用户手机号)
|
||||||
|
<a data-url="manystore/user_auth/changeuser" href="javascript:;" class="btn btn-success btn-changeuser {:$auth->check('manystore/user_auth/changeuser')?'':'hide'}" title="根据手机号生成用户" ><i class="fa fa-plus"></i> 根据手机号生成用户</a>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<!-- <div class="form-group">-->
|
||||||
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
|
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>-->
|
||||||
<div class="col-xs-12 col-sm-8">
|
<!-- <div class="col-xs-12 col-sm-8">-->
|
||||||
|
<!-- -->
|
||||||
|
<!-- <div class="radio">-->
|
||||||
|
<!-- {foreach name="statusList" item="vo"}-->
|
||||||
|
<!-- <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="0"}checked{/in} /> {$vo}</label> -->
|
||||||
|
<!-- {/foreach}-->
|
||||||
|
<!-- </div>-->
|
||||||
|
|
||||||
<div class="radio">
|
<!-- </div>-->
|
||||||
{foreach name="statusList" item="vo"}
|
<!-- </div>-->
|
||||||
<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="0"}checked{/in} /> {$vo}</label>
|
<!-- <div class="form-group">-->
|
||||||
{/foreach}
|
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Auth_time')}:</label>-->
|
||||||
</div>
|
<!-- <div class="col-xs-12 col-sm-8">-->
|
||||||
|
<!-- <input id="c-auth_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[auth_time]" type="text" value="{:date('Y-m-d H:i:s')}">-->
|
||||||
</div>
|
<!-- </div>-->
|
||||||
</div>
|
<!-- </div>-->
|
||||||
<div class="form-group">
|
<!-- <div class="form-group">-->
|
||||||
<label class="control-label col-xs-12 col-sm-2">{:__('Auth_time')}:</label>
|
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Update_time')}:</label>-->
|
||||||
<div class="col-xs-12 col-sm-8">
|
<!-- <div class="col-xs-12 col-sm-8">-->
|
||||||
<input id="c-auth_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[auth_time]" type="text" value="{:date('Y-m-d H:i:s')}">
|
<!-- <input id="c-update_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[update_time]" type="text" value="{:date('Y-m-d H:i:s')}">-->
|
||||||
</div>
|
<!-- </div>-->
|
||||||
</div>
|
<!-- </div>-->
|
||||||
<div class="form-group">
|
|
||||||
<label class="control-label col-xs-12 col-sm-2">{:__('Update_time')}:</label>
|
|
||||||
<div class="col-xs-12 col-sm-8">
|
|
||||||
<input id="c-update_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[update_time]" type="text" value="{:date('Y-m-d H:i:s')}">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group layer-footer">
|
<div class="form-group layer-footer">
|
||||||
<label class="control-label col-xs-12 col-sm-2"></label>
|
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||||
<div class="col-xs-12 col-sm-8">
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
|
|
@ -3,7 +3,12 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
|
<label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
|
||||||
<div class="col-xs-12 col-sm-8">
|
<div class="col-xs-12 col-sm-8">
|
||||||
<input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="{$row.user_id|htmlentities}">
|
<input id="c-user_id" data-rule="required" class="form-control" name="row[user_id]" type="text" value="{$row.user_id|htmlentities}">
|
||||||
|
<!-- <span style="color: red">(请先让对方登录小程序,之后输入小程序端用户:手机号,昵称 或 姓名 )</span>-->
|
||||||
|
<span style="color: red">
|
||||||
|
(没找到用户则点击按钮创建用户后重新填入用户手机号)
|
||||||
|
<a data-url="manystore/user_auth/changeuser" href="javascript:;" class="btn btn-success btn-changeuser {:$auth->check('manystore/user_auth/changeuser')?'':'hide'}" title="根据手机号生成用户" ><i class="fa fa-plus"></i> 根据手机号生成用户</a>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
@ -12,7 +17,7 @@
|
||||||
|
|
||||||
<div class="radio">
|
<div class="radio">
|
||||||
{foreach name="statusList" item="vo"}
|
{foreach name="statusList" item="vo"}
|
||||||
<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label>
|
<label for="row[status]-{$key}"><input id="row[status]-{$key}" readonly disabled type="radio" value="{$key}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -21,20 +26,20 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label col-xs-12 col-sm-2">{:__('Auth_time')}:</label>
|
<label class="control-label col-xs-12 col-sm-2">{:__('Auth_time')}:</label>
|
||||||
<div class="col-xs-12 col-sm-8">
|
<div class="col-xs-12 col-sm-8">
|
||||||
<input id="c-auth_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[auth_time]" type="text" value="{:$row.auth_time?datetime($row.auth_time):''}">
|
<input id="c-auth_time" class="form-control datetimepicker" readonly disabled data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[auth_time]" type="text" value="{:$row.auth_time?datetime($row.auth_time):''}">
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="control-label col-xs-12 col-sm-2">{:__('Update_time')}:</label>
|
|
||||||
<div class="col-xs-12 col-sm-8">
|
|
||||||
<input id="c-update_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[update_time]" type="text" value="{:$row.update_time?datetime($row.update_time):''}">
|
|
||||||
</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 disabled">{:__('OK')}</button>
|
|
||||||
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- <div class="form-group">-->
|
||||||
|
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Update_time')}:</label>-->
|
||||||
|
<!-- <div class="col-xs-12 col-sm-8">-->
|
||||||
|
<!-- <input id="c-update_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[update_time]" type="text" value="{:$row.update_time?datetime($row.update_time):''}">-->
|
||||||
|
<!-- </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 disabled">{:__('OK')}</button>-->
|
||||||
|
<!-- <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- </div>-->
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -18,21 +18,21 @@
|
||||||
<div id="toolbar" class="toolbar">
|
<div id="toolbar" class="toolbar">
|
||||||
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
|
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
|
||||||
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('manystore/user_auth/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
|
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('manystore/user_auth/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
|
||||||
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('manystore/user_auth/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
|
<!-- <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('manystore/user_auth/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>-->
|
||||||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('manystore/user_auth/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
|
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('manystore/user_auth/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
|
||||||
|
|
||||||
<div class="dropdown btn-group {:$auth->check('manystore/user_auth/multi')?'':'hide'}">
|
<!-- <div class="dropdown btn-group {:$auth->check('manystore/user_auth/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>
|
<!-- <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">
|
<!-- <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=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>
|
<!-- <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>
|
<!-- </ul>-->
|
||||||
</div>
|
<!-- </div>-->
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
|
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
|
||||||
data-operate-edit="{:$auth->check('manystore/user_auth/edit')}"
|
data-operate-edit="0"
|
||||||
data-operate-del="{:$auth->check('manystore/user_auth/del')}"
|
data-operate-del="{:$auth->check('manystore/user_auth/del')}"
|
||||||
width="100%">
|
width="100%">
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -127,7 +127,7 @@
|
||||||
<div class="col-xs-12 col-sm-8">
|
<div class="col-xs-12 col-sm-8">
|
||||||
<div class="radio">
|
<div class="radio">
|
||||||
{foreach name="addressTypeList" item="vo"}
|
{foreach name="addressTypeList" item="vo"}
|
||||||
<label for="row[address_type]-{$key}"><input data-rule="required" id="row[address_type]-{$key}" name="row[address_type]" type="radio" value="{$key}" {in name="key" value="1"}checked{/in} /> {$vo}</label>
|
<label for="row[address_type]-{$key}"><input id="row[address_type]-{$key}" name="row[address_type]" type="radio" value="{$key}" {in name="key" value="1"}checked{/in} /> {$vo}</label>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
<span style="color: red">( 如果选独立位置需填写具体位置信息! )</span>
|
<span style="color: red">( 如果选独立位置需填写具体位置信息! )</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -171,7 +171,7 @@
|
||||||
<div class="col-xs-12 col-sm-8">
|
<div class="col-xs-12 col-sm-8">
|
||||||
<div class="radio">
|
<div class="radio">
|
||||||
{foreach name="addressTypeList" item="vo"}
|
{foreach name="addressTypeList" item="vo"}
|
||||||
<label for="row[address_type]-{$key}"><input data-rule="required" id="row[address_type]-{$key}" name="row[address_type]" type="radio" value="{$key}" {in name="key" value="$row.address_type"}checked{/in} /> {$vo}</label>
|
<label for="row[address_type]-{$key}"><input id="row[address_type]-{$key}" name="row[address_type]" type="radio" value="{$key}" {in name="key" value="$row.address_type"}checked{/in} /> {$vo}</label>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
<span style="color: red">( 如果选独立位置需填写具体位置信息! )</span>
|
<span style="color: red">( 如果选独立位置需填写具体位置信息! )</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
namespace bw;
|
namespace bw;
|
||||||
|
|
||||||
|
|
||||||
|
use addons\epay\library\Service;
|
||||||
use app\admin\model\Miniqrcode;
|
use app\admin\model\Miniqrcode;
|
||||||
use app\admin\model\Xftts;
|
use app\admin\model\Xftts;
|
||||||
use app\common\library\Upload;
|
use app\common\library\Upload;
|
||||||
|
@ -293,9 +294,9 @@ class Common
|
||||||
* @throws \think\db\exception\ModelNotFoundException
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
* @throws \think\exception\DbException
|
* @throws \think\exception\DbException
|
||||||
*/
|
*/
|
||||||
public static function getMiniappCode($path,$scene='',$cache = true){
|
public static function getMiniappCode($scene, $page, $width = 430, $auto_color = false, $line_color = ["r" => "0", "g" => "0", "b" => "0"], $is_hyaline = true, $outType = null, $check_path = true, $env_version = 'release',$cache = true){
|
||||||
// 写入到文件
|
// 写入到文件
|
||||||
$file_name = md5( $path.$scene.'MiniCode') . '.png';
|
$file_name = md5( $page.$scene.'MiniCode') . '.png';
|
||||||
if($cache){
|
if($cache){
|
||||||
$file_info = Attachment::where('filename',$file_name)->find();
|
$file_info = Attachment::where('filename',$file_name)->find();
|
||||||
if($file_info){
|
if($file_info){
|
||||||
|
@ -303,17 +304,29 @@ class Common
|
||||||
return $file_info;
|
return $file_info;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (empty($path)) {
|
if (empty($page)) {
|
||||||
$path = 'pages/index/index';
|
$page = 'pages/index/index';
|
||||||
}
|
}
|
||||||
$wechat = new \addons\shopro\library\Wechat('wxMiniProgram');
|
// $wechat = new \addons\shopro\library\Wechat('wxMiniProgram');
|
||||||
$content = $wechat->getApp()->app_code->getUnlimit($scene, [
|
// $content = $wechat->getApp()->app_code->getUnlimit($scene, [
|
||||||
'page' => $path,
|
// 'page' => $path,
|
||||||
'is_hyaline' => true,
|
// 'is_hyaline' => true,
|
||||||
]);
|
// ]);
|
||||||
if ($content instanceof \EasyWeChat\Kernel\Http\StreamResponse) {
|
|
||||||
|
// 实例对应的接口对象
|
||||||
|
$scheme = new \WeMini\Qrcode(Service::wechatConfig());
|
||||||
|
$content = $scheme->createMiniScene($scene, $page, $width, $auto_color, $line_color ? ( is_array($line_color) ? $line_color : json_decode($line_color, true)) : ["r" => "0", "g" => "0", "b" => "0"], $is_hyaline, null, $check_path, $env_version);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if ($content instanceof \EasyWeChat\Kernel\Http\StreamResponse || is_string($content)) {
|
||||||
$filePath = ROOT_PATH . 'public/uploads/qrcode/' . $file_name;
|
$filePath = ROOT_PATH . 'public/uploads/qrcode/' . $file_name;
|
||||||
|
if(is_string($content)){
|
||||||
|
file_put_contents(ROOT_PATH . 'public/uploads/qrcode/'.$file_name, $content);
|
||||||
|
}else{
|
||||||
$content->saveAs(ROOT_PATH . 'public/uploads/qrcode', $file_name);
|
$content->saveAs(ROOT_PATH . 'public/uploads/qrcode', $file_name);
|
||||||
|
}
|
||||||
|
|
||||||
//保存到fastadmin框架
|
//保存到fastadmin框架
|
||||||
$attachment = Common::setFastAdminFile($filePath, $file_name);
|
$attachment = Common::setFastAdminFile($filePath, $file_name);
|
||||||
$attachment['full_url'] = cdnurl($attachment['url'],true);
|
$attachment['full_url'] = cdnurl($attachment['url'],true);
|
||||||
|
@ -322,6 +335,7 @@ class Common
|
||||||
return $attachment;
|
return $attachment;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
var_dump(gettype($content));
|
||||||
// 小程序码获取失败
|
// 小程序码获取失败
|
||||||
$msg = isset($content['errcode']) ? $content['errcode'] : '-';
|
$msg = isset($content['errcode']) ? $content['errcode'] : '-';
|
||||||
$msg .= isset($content['errmsg']) ? $content['errmsg'] : '';
|
$msg .= isset($content['errmsg']) ? $content['errmsg'] : '';
|
||||||
|
|
|
@ -101,4 +101,161 @@ define(['jquery', 'bootstrap', 'backend', 'form', 'table'], function ($, undefin
|
||||||
},
|
},
|
||||||
success: function (layero, index) {
|
success: function (layero, index) {
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
select: function () {
|
||||||
|
// 初始化表格参数配置
|
||||||
|
Table.api.init({
|
||||||
|
extend: {
|
||||||
|
index_url: 'general/attachment/select',
|
||||||
|
}
|
||||||
|
});
|
||||||
|
var urlArr = [];
|
||||||
|
var multiple = Backend.api.query('multiple');
|
||||||
|
multiple = multiple == 'true' ? true : false;
|
||||||
|
|
||||||
|
var table = $("#table");
|
||||||
|
|
||||||
|
table.on('check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table', function (e, row) {
|
||||||
|
if (e.type == 'check' || e.type == 'uncheck') {
|
||||||
|
row = [row];
|
||||||
|
} else {
|
||||||
|
urlArr = [];
|
||||||
|
}
|
||||||
|
$.each(row, function (i, j) {
|
||||||
|
if (e.type.indexOf("uncheck") > -1) {
|
||||||
|
var index = urlArr.indexOf(j.url);
|
||||||
|
if (index > -1) {
|
||||||
|
urlArr.splice(index, 1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
urlArr.indexOf(j.url) == -1 && urlArr.push(j.url);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// 初始化表格
|
||||||
|
table.bootstrapTable({
|
||||||
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||||
|
sortName: 'id',
|
||||||
|
showToggle: false,
|
||||||
|
showExport: false,
|
||||||
|
maintainSelected: true,
|
||||||
|
fixedColumns: true,
|
||||||
|
fixedRightNumber: 1,
|
||||||
|
columns: [
|
||||||
|
[
|
||||||
|
{field: 'state', checkbox: multiple, visible: multiple, operate: false},
|
||||||
|
{field: 'id', title: __('Id')},
|
||||||
|
{field: 'category', title: __('Category'), operate: 'in', formatter: Table.api.formatter.label, searchList: Config.categoryList},
|
||||||
|
{field: 'admin_id', title: __('Admin_id'), formatter: Table.api.formatter.search, visible: false},
|
||||||
|
{field: 'user_id', title: __('User_id'), formatter: Table.api.formatter.search, visible: false},
|
||||||
|
{field: 'url', title: __('Preview'), formatter: Controller.api.formatter.thumb, operate: false},
|
||||||
|
{field: 'filename', title: __('Filename'), sortable: true, formatter: Controller.api.formatter.filename, operate: 'like'},
|
||||||
|
{field: 'imagewidth', title: __('Imagewidth'), operate: false, sortable: true},
|
||||||
|
{field: 'imageheight', title: __('Imageheight'), operate: false, sortable: true},
|
||||||
|
{
|
||||||
|
field: 'mimetype', title: __('Mimetype'), sortable: true, operate: 'LIKE %...%',
|
||||||
|
process: function (value, arg) {
|
||||||
|
return value.replace(/\*/g, '%');
|
||||||
|
},
|
||||||
|
formatter: Controller.api.formatter.mimetype
|
||||||
|
},
|
||||||
|
{field: 'createtime', title: __('Createtime'), width: 120, formatter: Table.api.formatter.datetime, datetimeFormat: 'YYYY-MM-DD', operate: 'RANGE', addclass: 'datetimerange', sortable: true},
|
||||||
|
{
|
||||||
|
field: 'operate', title: __('Operate'), width: 85, events: {
|
||||||
|
'click .btn-chooseone': function (e, value, row, index) {
|
||||||
|
Fast.api.close({url: row.url, multiple: multiple});
|
||||||
|
},
|
||||||
|
}, formatter: function () {
|
||||||
|
return '<a href="javascript:;" class="btn btn-danger btn-chooseone btn-xs"><i class="fa fa-check"></i> ' + __('Choose') + '</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
// 绑定过滤事件
|
||||||
|
$('.filter-type ul li a', table.closest(".panel-intro")).on('click', function (e) {
|
||||||
|
$(this).closest("ul").find("li").removeClass("active");
|
||||||
|
$(this).closest("li").addClass("active");
|
||||||
|
var field = 'mimetype';
|
||||||
|
var value = $(this).data("value") || '';
|
||||||
|
var object = $("[name='" + field + "']", table.closest(".bootstrap-table").find(".commonsearch-table"));
|
||||||
|
if (object.prop('tagName') == "SELECT") {
|
||||||
|
$("option[value='" + value + "']", object).prop("selected", true);
|
||||||
|
} else {
|
||||||
|
object.val(value);
|
||||||
|
}
|
||||||
|
table.trigger("uncheckbox");
|
||||||
|
table.bootstrapTable('refresh', {pageNumber: 1});
|
||||||
|
});
|
||||||
|
|
||||||
|
// 选中多个
|
||||||
|
$(document).on("click", ".btn-choose-multi", function () {
|
||||||
|
Fast.api.close({url: urlArr.join(","), multiple: multiple});
|
||||||
|
});
|
||||||
|
|
||||||
|
// 为表格绑定事件
|
||||||
|
Table.api.bindevent(table);
|
||||||
|
require(['upload'], function (Upload) {
|
||||||
|
$("#toolbar .faupload").data("category", function (file) {
|
||||||
|
var category = $("ul.nav-tabs[data-field='category'] li.active a").data("value");
|
||||||
|
return category;
|
||||||
|
});
|
||||||
|
Upload.api.upload($("#toolbar .faupload"), function () {
|
||||||
|
$(".btn-refresh").trigger("click");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
add: function () {
|
||||||
|
//上传完成后刷新父窗口
|
||||||
|
$(".faupload").data("upload-complete", function (files) {
|
||||||
|
setTimeout(function () {
|
||||||
|
window.parent.$(".btn-refresh").trigger("click");
|
||||||
|
}, 100);
|
||||||
|
});
|
||||||
|
// 获取上传类别
|
||||||
|
$("#faupload-third,#faupload-third-chunking").data("category", function (file) {
|
||||||
|
return $("#category-third").val();
|
||||||
|
});
|
||||||
|
// 获取上传类别
|
||||||
|
$("#faupload-local,#faupload-local-chunking").data("category", function (file) {
|
||||||
|
return $("#category-local").val();
|
||||||
|
});
|
||||||
|
Controller.api.bindevent();
|
||||||
|
},
|
||||||
|
edit: function () {
|
||||||
|
Controller.api.bindevent();
|
||||||
|
},
|
||||||
|
api: {
|
||||||
|
bindevent: function () {
|
||||||
|
Form.api.bindevent($("form[role=form]"));
|
||||||
|
},
|
||||||
|
formatter: {
|
||||||
|
thumb: function (value, row, index) {
|
||||||
|
var html = '';
|
||||||
|
if (row.mimetype.indexOf("image") > -1) {
|
||||||
|
html = '<a href="' + row.fullurl + '" target="_blank"><img src="' + row.fullurl + row.thumb_style + '" alt="" style="max-height:60px;max-width:120px"></a>';
|
||||||
|
} else {
|
||||||
|
html = '<a href="' + row.fullurl + '" target="_blank"><img src="' + Fast.api.fixurl("ajax/icon") + "?suffix=" + row.imagetype + '" alt="" style="max-height:90px;max-width:120px"></a>';
|
||||||
|
}
|
||||||
|
return '<div style="width:120px;margin:0 auto;text-align:center;overflow:hidden;white-space: nowrap;text-overflow: ellipsis;">' + html + '</div>';
|
||||||
|
},
|
||||||
|
url: function (value, row, index) {
|
||||||
|
return '<a href="' + row.fullurl + '" target="_blank" class="label bg-green">' + row.url + '</a>';
|
||||||
|
},
|
||||||
|
filename: function (value, row, index) {
|
||||||
|
return '<div style="width:150px;margin:0 auto;text-align:center;overflow:hidden;white-space: nowrap;text-overflow: ellipsis;">' + Table.api.formatter.search.call(this, value, row, index) + '</div>';
|
||||||
|
},
|
||||||
|
mimetype: function (value, row, index) {
|
||||||
|
return '<div style="width:80px;margin:0 auto;text-align:center;overflow:hidden;white-space: nowrap;text-overflow: ellipsis;">' + Table.api.formatter.search.call(this, value, row, index) + '</div>';
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
return Controller;
|
||||||
|
});
|
||||||
|
|
|
@ -25,7 +25,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||||
columns: [
|
columns: [
|
||||||
[
|
[
|
||||||
{checkbox: true},
|
{checkbox: true},
|
||||||
{field: 'operate', title: __('Operate'),width:900, table: table , buttons: [
|
{field: 'operate', title: __('Operate'),width:980, table: table , buttons: [
|
||||||
{name: 'free',
|
{name: 'free',
|
||||||
text: '免登录进入机构后台',
|
text: '免登录进入机构后台',
|
||||||
icon: 'fa fa-sign-in',
|
icon: 'fa fa-sign-in',
|
||||||
|
@ -136,7 +136,20 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||||
// return row.status == '2'||row.status == '3';
|
// return row.status == '2'||row.status == '3';
|
||||||
// }
|
// }
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'user_auth',
|
||||||
|
text: __('机构授权用户'),
|
||||||
|
title: __('机构授权用户'),
|
||||||
|
classname: 'btn btn-xs btn-primary btn-dialog',
|
||||||
|
icon: 'fa fa-list',
|
||||||
|
url: user_auth_url,
|
||||||
|
callback: function (data) {
|
||||||
|
|
||||||
|
},
|
||||||
|
// visible: function (row) {
|
||||||
|
// return row.status == '2'||row.status == '3';
|
||||||
|
// }
|
||||||
|
},
|
||||||
//
|
//
|
||||||
// {name: 'unsetmockauth',
|
// {name: 'unsetmockauth',
|
||||||
// text: '取消加圈资格',
|
// text: '取消加圈资格',
|
||||||
|
@ -318,5 +331,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||||
return 'school/classes/hourorder/order/index?shop_id='+row.id;
|
return 'school/classes/hourorder/order/index?shop_id='+row.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var user_auth_url = function (row,dom) {
|
||||||
|
return 'manystore/user_auth/index?shop_id='+row.id;
|
||||||
|
}
|
||||||
|
|
||||||
return Controller;
|
return Controller;
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,8 +6,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||||
Table.api.init({
|
Table.api.init({
|
||||||
extend: {
|
extend: {
|
||||||
index_url: 'manystore/user_auth/index' + location.search,
|
index_url: 'manystore/user_auth/index' + location.search,
|
||||||
add_url: 'manystore/user_auth/add',
|
add_url: 'manystore/user_auth/add'+ location.search,
|
||||||
edit_url: 'manystore/user_auth/edit',
|
edit_url: 'manystore/user_auth/edit'+ location.search,
|
||||||
del_url: 'manystore/user_auth/del',
|
del_url: 'manystore/user_auth/del',
|
||||||
multi_url: 'manystore/user_auth/multi',
|
multi_url: 'manystore/user_auth/multi',
|
||||||
import_url: 'manystore/user_auth/import',
|
import_url: 'manystore/user_auth/import',
|
||||||
|
@ -26,15 +26,17 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||||
[
|
[
|
||||||
{checkbox: true},
|
{checkbox: true},
|
||||||
{field: 'id', title: __('Id')},
|
{field: 'id', title: __('Id')},
|
||||||
{field: 'shop_id', title: __('Shop_id')},
|
|
||||||
{field: 'user_id', title: __('User_id')},
|
|
||||||
{field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status},
|
{field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status},
|
||||||
{field: 'auth_time', title: __('Auth_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
|
||||||
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
|
||||||
{field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
|
||||||
{field: 'shop.name', title: __('Shop.name'), operate: 'LIKE'},
|
{field: 'shop.name', title: __('Shop.name'), operate: 'LIKE'},
|
||||||
{field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
|
{field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
|
||||||
{field: 'user.avatar', title: __('User.avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
|
{field: 'user.avatar', title: __('User.avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
|
||||||
|
{field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
|
||||||
|
{field: 'shop_id', title: __('Shop_id')},
|
||||||
|
{field: 'user_id', title: __('User_id')},
|
||||||
|
{field: 'auth_time', title: __('Auth_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||||
|
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||||
|
{field: 'update_time', title: __('Update_time'), 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}
|
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
|
@ -0,0 +1,79 @@
|
||||||
|
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||||
|
|
||||||
|
var Controller = {
|
||||||
|
index: function () {
|
||||||
|
// 初始化表格参数配置
|
||||||
|
Table.api.init({
|
||||||
|
extend: {
|
||||||
|
index_url: 'school/classes/blacklist/index' + location.search,
|
||||||
|
add_url: 'school/classes/blacklist/add'+ location.search,
|
||||||
|
edit_url: 'school/classes/blacklist/edit'+ location.search,
|
||||||
|
del_url: 'school/classes/blacklist/del',
|
||||||
|
multi_url: 'school/classes/blacklist/multi',
|
||||||
|
import_url: 'school/classes/blacklist/import',
|
||||||
|
table: 'school_classes_blacklist',
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
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')},
|
||||||
|
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||||
|
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||||
|
{field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
|
||||||
|
{field: 'user.realname', title: __('User.realname'), operate: 'LIKE'},
|
||||||
|
{field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
|
||||||
|
{field: 'user.avatar', title: __('User.avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
|
||||||
|
{field: 'operate', title: __('Operate'), 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 () {
|
||||||
|
|
||||||
|
$(document).on('click', '.btn-changeuser', function (event) {
|
||||||
|
var url = $(this).attr('data-url');
|
||||||
|
if(!url) return false;
|
||||||
|
var title = $(this).attr('title');
|
||||||
|
var width = $(this).attr('data-width');
|
||||||
|
var height = $(this).attr('data-height');
|
||||||
|
// var ids = $(this).attr('data-id');
|
||||||
|
var area = [$(window).width() > 800 ? (width?width:'800px') : '95%', $(window).height() > 600 ? (height?height:'600px') : '95%'];
|
||||||
|
var options = {
|
||||||
|
shadeClose: false,
|
||||||
|
shade: [0.3, '#393D49'],
|
||||||
|
area: area,
|
||||||
|
callback:function(ret){//回调方法,需要在本页面Controller中增加方法监听且调用Fast.api.close(ret)传递结果;
|
||||||
|
Fast.api.close(ret);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Fast.api.open(url,title,options);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Form.api.bindevent($("form[role=form]"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return Controller;
|
||||||
|
});
|
|
@ -25,6 +25,57 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||||
[
|
[
|
||||||
{checkbox: true},
|
{checkbox: true},
|
||||||
{field: 'operate', title: __('Operate'), table: table , buttons: [
|
{field: 'operate', title: __('Operate'), table: table , buttons: [
|
||||||
|
|
||||||
|
{
|
||||||
|
name: 'user_auth',
|
||||||
|
text: __('设置机构授权'),
|
||||||
|
title: __('设置机构授权'),
|
||||||
|
classname: 'btn btn-xs btn-danger btn-magic btn-dialog',
|
||||||
|
icon: 'fa fa-list',
|
||||||
|
url: user_auth_url,
|
||||||
|
callback: function (data) {
|
||||||
|
|
||||||
|
},
|
||||||
|
// visible: function (row) {
|
||||||
|
// return row.status == '2'||row.status == '3';
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
name: 'teacher',
|
||||||
|
text: __('设置老师'),
|
||||||
|
title: __('设置老师'),
|
||||||
|
classname: 'btn btn-xs btn-danger btn-magic btn-dialog',
|
||||||
|
icon: 'fa fa-list',
|
||||||
|
url: teacher_url,
|
||||||
|
callback: function (data) {
|
||||||
|
|
||||||
|
},
|
||||||
|
// visible: function (row) {
|
||||||
|
// return row.status == '2'||row.status == '3';
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
name: 'verification',
|
||||||
|
text: __('设置核销员'),
|
||||||
|
title: __('设置核销员'),
|
||||||
|
classname: 'btn btn-xs btn-danger btn-magic btn-dialog',
|
||||||
|
icon: 'fa fa-list',
|
||||||
|
url: verification_url,
|
||||||
|
callback: function (data) {
|
||||||
|
|
||||||
|
},
|
||||||
|
// visible: function (row) {
|
||||||
|
// return row.status == '2'||row.status == '3';
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
name: 'third',
|
name: 'third',
|
||||||
text: __('三方账号信息'),
|
text: __('三方账号信息'),
|
||||||
|
@ -155,5 +206,20 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||||
return 'school/classes/hourorder/order/index?user_id='+row.id;
|
return 'school/classes/hourorder/order/index?user_id='+row.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var user_auth_url = function (row,dom) {
|
||||||
|
return 'manystore/user_auth/index?user_id='+row.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
var teacher_url = function (row,dom) {
|
||||||
|
return 'school/classes/teacher/index?user_id='+row.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
var verification_url = function (row,dom) {
|
||||||
|
return 'school/classes/verification/index?user_id='+row.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return Controller;
|
return Controller;
|
||||||
});
|
});
|
|
@ -134,7 +134,7 @@ define(['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, undefine
|
||||||
title = options && options.title ? options.title : (title ? title : "");
|
title = options && options.title ? options.title : (title ? title : "");
|
||||||
url = Fast.api.fixurl(url);
|
url = Fast.api.fixurl(url);
|
||||||
url = url + (url.indexOf("?") > -1 ? "&" : "?") + "dialog=1";
|
url = url + (url.indexOf("?") > -1 ? "&" : "?") + "dialog=1";
|
||||||
var area = Fast.config.openArea != undefined ? Fast.config.openArea : [$(window).width() > 800 ? '800px' : '95%', $(window).height() > 600 ? '600px' : '95%'];
|
var area = Fast.config.openArea != undefined ? Fast.config.openArea : [ '98%', '98%'];
|
||||||
var success = options && typeof options.success === 'function' ? options.success : $.noop;
|
var success = options && typeof options.success === 'function' ? options.success : $.noop;
|
||||||
if (options && typeof options.success === 'function') {
|
if (options && typeof options.success === 'function') {
|
||||||
delete options.success;
|
delete options.success;
|
||||||
|
|
|
@ -6,8 +6,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||||
Table.api.init({
|
Table.api.init({
|
||||||
extend: {
|
extend: {
|
||||||
index_url: 'manystore/user_auth/index' + location.search,
|
index_url: 'manystore/user_auth/index' + location.search,
|
||||||
add_url: 'manystore/user_auth/add',
|
add_url: 'manystore/user_auth/add'+ location.search,
|
||||||
edit_url: 'manystore/user_auth/edit',
|
edit_url: 'manystore/user_auth/edit'+ location.search,
|
||||||
del_url: 'manystore/user_auth/del',
|
del_url: 'manystore/user_auth/del',
|
||||||
multi_url: 'manystore/user_auth/multi',
|
multi_url: 'manystore/user_auth/multi',
|
||||||
import_url: 'manystore/user_auth/import',
|
import_url: 'manystore/user_auth/import',
|
||||||
|
@ -26,15 +26,17 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||||
[
|
[
|
||||||
{checkbox: true},
|
{checkbox: true},
|
||||||
{field: 'id', title: __('Id')},
|
{field: 'id', title: __('Id')},
|
||||||
{field: 'shop_id', title: __('Shop_id')},
|
{field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
|
||||||
{field: 'user_id', title: __('User_id')},
|
{field: 'user.avatar', title: __('User.avatar'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
|
||||||
|
{field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
|
||||||
|
|
||||||
{field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status},
|
{field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status},
|
||||||
|
// {field: 'shop_id', title: __('Shop_id')},
|
||||||
|
{field: 'user_id', title: __('User_id')},
|
||||||
{field: 'auth_time', title: __('Auth_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
{field: 'auth_time', title: __('Auth_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||||
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||||
{field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
{field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||||
{field: 'manystoreshop.name', title: __('Manystoreshop.name'), operate: 'LIKE'},
|
// {field: 'manystoreshop.name', title: __('Manystoreshop.name'), operate: 'LIKE'},
|
||||||
{field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
|
|
||||||
{field: 'user.avatar', title: __('User.avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
|
|
||||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
@ -75,6 +77,28 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||||
},
|
},
|
||||||
api: {
|
api: {
|
||||||
bindevent: function () {
|
bindevent: function () {
|
||||||
|
|
||||||
|
|
||||||
|
$(document).on('click', '.btn-changeuser', function (event) {
|
||||||
|
var url = $(this).attr('data-url');
|
||||||
|
if(!url) return false;
|
||||||
|
var title = $(this).attr('title');
|
||||||
|
var width = $(this).attr('data-width');
|
||||||
|
var height = $(this).attr('data-height');
|
||||||
|
// var ids = $(this).attr('data-id');
|
||||||
|
var area = [$(window).width() > 800 ? (width?width:'800px') : '95%', $(window).height() > 600 ? (height?height:'600px') : '95%'];
|
||||||
|
var options = {
|
||||||
|
shadeClose: false,
|
||||||
|
shade: [0.3, '#393D49'],
|
||||||
|
area: area,
|
||||||
|
callback:function(ret){//回调方法,需要在本页面Controller中增加方法监听且调用Fast.api.close(ret)传递结果;
|
||||||
|
Fast.api.close(ret);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Fast.api.open(url,title,options);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
Form.api.bindevent($("form[role=form]"));
|
Form.api.bindevent($("form[role=form]"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue