作者 刘朕
1 个管道 的构建 通过 耗费 1 秒

合并分支 'liuzhen' 到 'master'

Liuzhen



查看合并请求 !51
... ... @@ -23,6 +23,7 @@ class Litestoregoods extends Backend
protected $model = null;
protected $dataLimit = true;
protected $dataLimitField = 'store_id';
protected $multiFields = 'is_recommend';
public function _initialize()
{
... ... @@ -34,6 +35,7 @@ class Litestoregoods extends Backend
$this->view->assign("specTypeList", $this->model->getSpecTypeList());
$this->view->assign("deductStockTypeList", $this->model->getDeductStockTypeList());
$this->view->assign("goodsStatusList", $this->model->getGoodsStatusList());
$this->view->assign("isRecommendList", $this->model->getIsRecommendList());
$this->view->assign("isDeleteList", $this->model->getIsDeleteList());
$this->view->assign("spec_attr", '');
... ...
<?php
namespace app\admin\controller\store;
use app\common\controller\Backend;
/**
* 开通新社区申请管理
*
* @icon fa fa-circle-o
*/
class StoreApply extends Backend
{
/**
* StoreApply模型对象
* @var \app\admin\model\store\StoreApply
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\store\StoreApply;
}
/**
* 默认生成的控制器所继承的父类中有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();
$total = $this->model
->with(['user'])
->where($where)
->order($sort, $order)
->count();
$list = $this->model
->with(['user'])
->where($where)
->order($sort, $order)
->limit($offset, $limit)
->select();
foreach ($list as $row) {
$row->getRelation('user')->visible(['nickname']);
}
$list = collection($list)->toArray();
$result = array("total" => $total, "rows" => $list);
return json($result);
}
return $this->view->fetch();
}
}
... ...
... ... @@ -21,6 +21,9 @@ return [
'Goods_status' => '商品状态',
'Goods_status 10' => '上架',
'Goods_status 20' => '下架',
'Is_recommend' => '是否首页推荐',
'Is_recommend 0' => '否',
'Is_recommend 1' => '是',
'Is_delete' => '是否删除',
'Is_delete 0' => '未删除',
'Is_delete 1' => '已删除',
... ...
<?php
return [
'User_id' => '用户id',
'Store_name' => '社区名称',
'City' => '市',
'Region' => '区',
'Name' => '姓名',
'Mobile' => '手机号',
'Createtime' => '生成时间',
'Updatetime' => '更新时间',
'User.nickname' => '昵称'
];
... ...
... ... @@ -21,6 +21,7 @@ class Litestoregoods extends Model
'spec_type_text',
'deduct_stock_type_text',
'goods_status_text',
'is_recommend_text',
'is_delete_text'
];
... ... @@ -47,7 +48,12 @@ class Litestoregoods extends Model
public function getGoodsStatusList()
{
return ['10' => __('Goods_status 10'),'20' => __('Goods_status 20')];
}
}
public function getIsRecommendList()
{
return ['0' => __('Is_recommend 0'),'1' => __('Is_recommend 1')];
}
public function getIsDeleteList()
{
... ... @@ -86,6 +92,13 @@ class Litestoregoods extends Model
return isset($list[$value]) ? $list[$value] : '';
}
public function getIsRecommendTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['is_recommend']) ? $data['is_recommend'] : '');
$list = $this->getIsRecommendList();
return isset($list[$value]) ? $list[$value] : '';
}
public function category()
{
return $this->belongsTo('litestorecategory', 'category_id', 'id', [], 'LEFT')->setEagerlyType(0);
... ...
<?php
namespace app\admin\model\store;
use think\Model;
class StoreApply extends Model
{
// 表名
protected $name = 'store_apply';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'int';
// 定义时间戳字段名
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);
}
}
... ...
<?php
namespace app\admin\validate\store;
use think\Validate;
class StoreApply extends Validate
{
/**
* 验证规则
*/
protected $rule = [
];
/**
* 提示消息
*/
protected $message = [
];
/**
* 验证场景
*/
protected $scene = [
'add' => [],
'edit' => [],
];
}
... ...
... ... @@ -216,6 +216,18 @@
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Is_recommend')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-is_recommend" data-rule="required" class="form-control selectpicker" name="row[is_recommend]">
{foreach name="isDeleteList" item="vo"}
<option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Is_delete')}:</label>
<div class="col-xs-12 col-sm-8">
... ...
... ... @@ -213,6 +213,18 @@
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Is_recommend')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-is_recommend" data-rule="required" class="form-control selectpicker" name="row[is_recommend]">
{foreach name="isRecommendList" item="vo"}
<option value="{$key}" {in name="key" value="$row.is_recommend"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Is_delete')}:</label>
<div class="col-xs-12 col-sm-8">
... ...
<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="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Store_name')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-store_name" data-rule="required" class="form-control" name="row[store_name]" type="text" value="''">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Province')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-province" data-rule="required" class="form-control" name="row[province]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('City')}:</label>
<div class="col-xs-12 col-sm-8">
<div class='control-relative'><input id="c-city" data-rule="required" class="form-control" data-toggle="city-picker" name="row[city]" type="text" value="''"></div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Region')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-region" data-rule="required" class="form-control" name="row[region]" type="text" value="''">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="''">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Mobile')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-mobile" data-rule="required" class="form-control" name="row[mobile]" type="text" value="''">
</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 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="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="{$row.user_id|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Store_name')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-store_name" data-rule="required" class="form-control" name="row[store_name]" type="text" value="{$row.store_name|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Province')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-province" data-rule="required" class="form-control" name="row[province]" type="text" value="{$row.province|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('City')}:</label>
<div class="col-xs-12 col-sm-8">
<div class='control-relative'><input id="c-city" data-rule="required" class="form-control" data-toggle="city-picker" name="row[city]" type="text" value="{$row.city|htmlentities}"></div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Region')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-region" data-rule="required" class="form-control" name="row[region]" type="text" value="{$row.region|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Mobile')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-mobile" data-rule="required" class="form-control" name="row[mobile]" type="text" value="{$row.mobile|htmlentities}">
</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>
... ...
<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('store/store_apply/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('store/store_apply/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('store/store_apply/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
<!-- <a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('store/store_apply/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>-->
<!-- <div class="dropdown btn-group {:$auth->check('store/store_apply/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>-->
<!-- <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=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>-->
<!-- </ul>-->
<!-- </div>-->
</div>
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
data-operate-edit="{:$auth->check('store/store_apply/edit')}"
data-operate-del="{:$auth->check('store/store_apply/del')}"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>
... ...
... ... @@ -244,9 +244,8 @@ class House extends Api
*/
public function goods()
{
$goods_ids = Db::name('config_goods')->where('id',1)->value('goods_ids');
$list = Db::name('litestore_goods')
->where('goods_id','in',$goods_ids)
->where('is_recommend',1)
->field('goods_id,goods_name,images')
->select();
foreach($list as &$v){
... ...
... ... @@ -16,6 +16,7 @@ use app\api\model\StoreOrder;
use app\api\model\UserScoreLog;
use app\api\validate\StoreValidate;
use app\common\controller\Api;
use app\common\library\Sms as Smslib;
use EasyWeChat\Foundation\Application;
use EasyWeChat\Payment\Order;
use think\Db;
... ... @@ -193,6 +194,7 @@ class Store extends Api
* @ApiParams (name="industry_id", type="string", required=true, description="行业/关键词")
* @ApiParams (name="name", type="string", required=true, description="联系人姓名")
* @ApiParams (name="mobile", type="string", required=true, description="联系人手机号")
* @ApiParams (name="code", type="string", required=true, description="验证码")
* @ApiParams (name="license", type="string", required=true, description="营业执照")
* @ApiReturnParams (name="code", type="integer", required=true, sample="0")
* @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
... ... @@ -220,6 +222,15 @@ class Store extends Api
$this->error('商家申请已通过');
}
}
// 验证码验证
$mobile = $param['mobile'];
$captcha = $param['code'];
$event = 'test';
$ret = Smslib::check($mobile, $captcha, $event);
if (!$ret) {
$this->error(__('验证码不正确'));
}
unset($param['code']);
$order_sn = $param['order_sn'] = get_order_sn();
// 获取配置
$app = new Application(ConfigService::load());
... ... @@ -282,6 +293,7 @@ class Store extends Api
* @ApiParams (name="region", type="string", required=true, description="区")
* @ApiParams (name="name", type="string", required=true, description="联系人姓名")
* @ApiParams (name="mobile", type="string", required=true, description="联系人手机号")
* @ApiParams (name="code", type="string", required=true, description="验证码")
* @ApiReturnParams (name="code", type="integer", required=true, sample="0")
* @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
* @ApiReturn ({
... ... @@ -292,6 +304,15 @@ class Store extends Api
public function store_apply()
{
$param = (new StoreValidate())->goCheck('store_apply');
// 验证码验证
$mobile = $param['mobile'];
$captcha = $param['code'];
$event = 'test';
$ret = Smslib::check($mobile, $captcha, $event);
if (!$ret) {
$this->error(__('验证码不正确'),$ret);
}
unset($param['code']);
Db::startTrans();
$result = false;
try{
... ...
... ... @@ -29,8 +29,8 @@ class StoreValidate extends BaseValidate
protected $scene = [
'common' => ['page'], // 公共分页验证
'store_add' => ['store_name','house_ids','industry_id','name','mobile','license'], // 店铺申请
'store_apply' => ['store_name','province','city','region','name','mobile'], // 开通社区提交
'store_add' => ['store_name','house_ids','industry_id','name','mobile','code','license'], // 店铺申请
'store_apply' => ['store_name','province','city','region','name','mobile','code'], // 开通社区提交
'store_report' => ['content'], // 举报建议提交
'store_edit' => ['store_icon','store_name','mobile','province','city','region','images'], // 店铺信息修改
'store_inform_add' => ['content','images','house_ids','type'], // 发布信息
... ...
... ... @@ -110,11 +110,10 @@ class Sms
} else {
// 过期则清空该手机验证码
self::flush($mobile, $event);
return 2;
return false;
}
} else {
return \app\common\model\Sms::where(['mobile' => $mobile, 'event' => $event])
->order('id', 'DESC')->buildSql();
return false;
}
}
... ...
... ... @@ -38,6 +38,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','template','litestoreg
{field: 'goods_sort', title: __('Goods_sort')},
// {field: 'delivery_id', title: __('Delivery_id')},
{field: 'goods_status', title: __('Goods_status'), searchList: {"10":__('Goods_status 10'),"20":__('Goods_status 20')}, formatter: Table.api.formatter.status},
{field: 'is_recommend', title: __('Is_recommend'),table:table, formatter: Table.api.formatter.toggle, yes: 1, no: 0, searchList: {0:__('Is_recommend 0'),1:__('Is_recommend 1')}},
{field: 'is_delete', title: __('Is_delete'), searchList: {"0":__('Is_delete 0'),"1":__('Is_delete 1')}, formatter: Table.api.formatter.normal},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
... ...
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'store/store_apply/index' + location.search,
add_url: 'store/store_apply/add',
edit_url: 'store/store_apply/edit',
del_url: 'store/store_apply/del',
multi_url: 'store/store_apply/multi',
table: 'store_apply',
}
});
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: 'store_name', title: __('Store_name')},
{field: 'province', title: __('Province')},
{field: 'city', title: __('City')},
{field: 'region', title: __('Region')},
{field: 'name', title: __('Name')},
{field: 'mobile', title: __('Mobile')},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
{field: 'user.nickname', title: __('User.nickname')},
{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 () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});
\ No newline at end of file
... ...