正在显示
10 个修改的文件
包含
321 行增加
和
1 行删除
application/admin/controller/Iphoneorder.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\controller; | ||
4 | + | ||
5 | +use app\common\controller\Backend; | ||
6 | +use think\Db; | ||
7 | + | ||
8 | +/** | ||
9 | + * 苹果充值订单 | ||
10 | + * | ||
11 | + * @icon fa fa-circle-o | ||
12 | + */ | ||
13 | +class Iphoneorder extends Backend | ||
14 | +{ | ||
15 | + | ||
16 | + /** | ||
17 | + * Iphoneorder模型对象 | ||
18 | + * @var \app\admin\model\Iphoneorder | ||
19 | + */ | ||
20 | + protected $model = null; | ||
21 | + | ||
22 | + public function _initialize() | ||
23 | + { | ||
24 | + parent::_initialize(); | ||
25 | + $this->model = new \app\admin\model\Iphoneorder; | ||
26 | + | ||
27 | + } | ||
28 | + | ||
29 | + /** | ||
30 | + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 | ||
31 | + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 | ||
32 | + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 | ||
33 | + */ | ||
34 | + | ||
35 | + /** | ||
36 | + * 添加 | ||
37 | + */ | ||
38 | + public function add() | ||
39 | + { | ||
40 | + if ($this->request->isPost()) { | ||
41 | + $params = $this->request->post("row/a"); | ||
42 | + if ($params) { | ||
43 | + $params = $this->preExcludeFields($params); | ||
44 | + if ($this->dataLimit && $this->dataLimitFieldAutoFill) { | ||
45 | + $params[$this->dataLimitField] = $this->auth->id; | ||
46 | + } | ||
47 | + $result = false; | ||
48 | + Db::startTrans(); | ||
49 | + try { | ||
50 | + //是否采用模型验证 | ||
51 | + if ($this->modelValidate) { | ||
52 | + $name = str_replace("\\model\\", "\\validate\\", get_class($this->model)); | ||
53 | + $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate; | ||
54 | + $this->model->validateFailException(true)->validate($validate); | ||
55 | + } | ||
56 | + $result = $this->model->allowField(true)->save($params); | ||
57 | + Db::commit(); | ||
58 | + } catch (ValidateException $e) { | ||
59 | + Db::rollback(); | ||
60 | + $this->error($e->getMessage()); | ||
61 | + } catch (PDOException $e) { | ||
62 | + Db::rollback(); | ||
63 | + $this->error($e->getMessage()); | ||
64 | + } catch (Exception $e) { | ||
65 | + Db::rollback(); | ||
66 | + $this->error($e->getMessage()); | ||
67 | + } | ||
68 | + if ($result !== false) { | ||
69 | + $this->success(); | ||
70 | + } else { | ||
71 | + $this->error(__('No rows were inserted')); | ||
72 | + } | ||
73 | + } | ||
74 | + $this->error(__('Parameter %s can not be empty', '')); | ||
75 | + } | ||
76 | + return $this->view->fetch(); | ||
77 | + } | ||
78 | + | ||
79 | + | ||
80 | +} |
application/admin/lang/zh-cn/iphoneorder.php
0 → 100644
application/admin/model/Iphoneorder.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\model; | ||
4 | + | ||
5 | +use think\Model; | ||
6 | + | ||
7 | + | ||
8 | +class Iphoneorder extends Model | ||
9 | +{ | ||
10 | + | ||
11 | + | ||
12 | + | ||
13 | + | ||
14 | + | ||
15 | + // 表名 | ||
16 | + protected $name = 'iphoneorder'; | ||
17 | + | ||
18 | + // 自动写入时间戳字段 | ||
19 | + protected $autoWriteTimestamp = 'int'; | ||
20 | + | ||
21 | + // 定义时间戳字段名 | ||
22 | + protected $createTime = 'createtime'; | ||
23 | + protected $updateTime = 'updatetime'; | ||
24 | + protected $deleteTime = false; | ||
25 | + | ||
26 | + // 追加属性 | ||
27 | + protected $append = [ | ||
28 | + | ||
29 | + ]; | ||
30 | + | ||
31 | + | ||
32 | + | ||
33 | + | ||
34 | + | ||
35 | + | ||
36 | + | ||
37 | + | ||
38 | + | ||
39 | + | ||
40 | +} |
application/admin/validate/Iphoneorder.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\validate; | ||
4 | + | ||
5 | +use think\Validate; | ||
6 | + | ||
7 | +class Iphoneorder extends Validate | ||
8 | +{ | ||
9 | + /** | ||
10 | + * 验证规则 | ||
11 | + */ | ||
12 | + protected $rule = [ | ||
13 | + ]; | ||
14 | + /** | ||
15 | + * 提示消息 | ||
16 | + */ | ||
17 | + protected $message = [ | ||
18 | + ]; | ||
19 | + /** | ||
20 | + * 验证场景 | ||
21 | + */ | ||
22 | + protected $scene = [ | ||
23 | + 'add' => [], | ||
24 | + 'edit' => [], | ||
25 | + ]; | ||
26 | + | ||
27 | +} |
application/admin/view/iphoneorder/add.html
0 → 100644
1 | +<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> | ||
2 | + | ||
3 | + <div class="form-group"> | ||
4 | + <label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label> | ||
5 | + <div class="col-xs-12 col-sm-8"> | ||
6 | + <input id="c-user_id" data-rule="required" data-source="user/user/index" data-params='{"custom[type]":"1"}' data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value=""> | ||
7 | + </div> | ||
8 | + </div> | ||
9 | + <div class="form-group"> | ||
10 | + <label class="control-label col-xs-12 col-sm-2">{:__('Money')}:</label> | ||
11 | + <div class="col-xs-12 col-sm-8"> | ||
12 | + <input id="c-money" class="form-control" step="0.01" name="row[money]" type="number"> | ||
13 | + </div> | ||
14 | + </div> | ||
15 | + <!--<div class="form-group">--> | ||
16 | + <!--<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>--> | ||
17 | + <!--<div class="col-xs-12 col-sm-8">--> | ||
18 | + <!--<input id="c-status" class="form-control" name="row[status]" type="number">--> | ||
19 | + <!--</div>--> | ||
20 | + <!--</div>--> | ||
21 | + <!--<div class="form-group">--> | ||
22 | + <!--<label class="control-label col-xs-12 col-sm-2">{:__('Num')}:</label>--> | ||
23 | + <!--<div class="col-xs-12 col-sm-8">--> | ||
24 | + <!--<input id="c-num" class="form-control" name="row[num]" type="text">--> | ||
25 | + <!--</div>--> | ||
26 | + <!--</div>--> | ||
27 | + <div class="form-group layer-footer"> | ||
28 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
29 | + <div class="col-xs-12 col-sm-8"> | ||
30 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
31 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
32 | + </div> | ||
33 | + </div> | ||
34 | +</form> |
application/admin/view/iphoneorder/edit.html
0 → 100644
1 | +<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> | ||
2 | + | ||
3 | + <div class="form-group"> | ||
4 | + <label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label> | ||
5 | + <div class="col-xs-12 col-sm-8"> | ||
6 | + <input id="c-user_id" data-rule="required" data-source="user/user/index" data-params='{"custom[type]":"1"}' data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="{$row.user_id|htmlentities}"> | ||
7 | + </div> | ||
8 | + </div> | ||
9 | + <div class="form-group"> | ||
10 | + <label class="control-label col-xs-12 col-sm-2">{:__('Money')}:</label> | ||
11 | + <div class="col-xs-12 col-sm-8"> | ||
12 | + <input id="c-money" class="form-control" step="0.01" name="row[money]" type="number" value="{$row.money|htmlentities}"> | ||
13 | + </div> | ||
14 | + </div> | ||
15 | + <div class="form-group"> | ||
16 | + <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label> | ||
17 | + <div class="col-xs-12 col-sm-8"> | ||
18 | + {:build_radios('row[status]', ['1'=>'待支付', '2'=>'已支付'],$row.status)} | ||
19 | + </div> | ||
20 | + </div> | ||
21 | + <!--<div class="form-group">--> | ||
22 | + <!--<label class="control-label col-xs-12 col-sm-2">{:__('Num')}:</label>--> | ||
23 | + <!--<div class="col-xs-12 col-sm-8">--> | ||
24 | + <!--<input id="c-num" class="form-control" name="row[num]" type="text" value="{$row.num|htmlentities}">--> | ||
25 | + <!--</div>--> | ||
26 | + <!--</div>--> | ||
27 | + <div class="form-group layer-footer"> | ||
28 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
29 | + <div class="col-xs-12 col-sm-8"> | ||
30 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
31 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
32 | + </div> | ||
33 | + </div> | ||
34 | +</form> |
1 | +<div class="panel panel-default panel-intro"> | ||
2 | + {:build_heading()} | ||
3 | + | ||
4 | + <div class="panel-body"> | ||
5 | + <div id="myTabContent" class="tab-content"> | ||
6 | + <div class="tab-pane fade active in" id="one"> | ||
7 | + <div class="widget-body no-padding"> | ||
8 | + <div id="toolbar" class="toolbar"> | ||
9 | + <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a> | ||
10 | + <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('iphoneorder/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a> | ||
11 | + <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('iphoneorder/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a> | ||
12 | + <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('iphoneorder/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a> | ||
13 | + <!--<a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('iphoneorder/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>--> | ||
14 | + | ||
15 | + <!--<div class="dropdown btn-group {:$auth->check('iphoneorder/multi')?'':'hide'}">--> | ||
16 | + <!--<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>--> | ||
17 | + <!--<ul class="dropdown-menu text-left" role="menu">--> | ||
18 | + <!--<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>--> | ||
19 | + <!--<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>--> | ||
20 | + <!--</ul>--> | ||
21 | + <!--</div>--> | ||
22 | + | ||
23 | + | ||
24 | + </div> | ||
25 | + <table id="table" class="table table-striped table-bordered table-hover table-nowrap" | ||
26 | + data-operate-edit="{:$auth->check('iphoneorder/edit')}" | ||
27 | + data-operate-del="{:$auth->check('iphoneorder/del')}" | ||
28 | + width="100%"> | ||
29 | + </table> | ||
30 | + </div> | ||
31 | + </div> | ||
32 | + | ||
33 | + </div> | ||
34 | + </div> | ||
35 | +</div> |
@@ -35,6 +35,7 @@ class User extends Api | @@ -35,6 +35,7 @@ class User extends Api | ||
35 | * @ApiParams (name="code", type="string", required=true, description="小程序code") | 35 | * @ApiParams (name="code", type="string", required=true, description="小程序code") |
36 | * @ApiParams (name="nickname", type="string", required=true, description="小程序昵称") | 36 | * @ApiParams (name="nickname", type="string", required=true, description="小程序昵称") |
37 | * @ApiParams (name="avatar", type="string", required=true, description="小程序头像") | 37 | * @ApiParams (name="avatar", type="string", required=true, description="小程序头像") |
38 | + * @ApiParams (name="type", type="inter", required=true, description="是否为苹果用户0否1是") | ||
38 | * @ApiReturn({ | 39 | * @ApiReturn({ |
39 | "code": 1, | 40 | "code": 1, |
40 | "msg": "登录成功", | 41 | "msg": "登录成功", |
@@ -52,7 +53,7 @@ class User extends Api | @@ -52,7 +53,7 @@ class User extends Api | ||
52 | if($this->request->isPost()){ | 53 | if($this->request->isPost()){ |
53 | //小程序配置 | 54 | //小程序配置 |
54 | $config = config('verify.raw'); | 55 | $config = config('verify.raw'); |
55 | - //小程序传递数据,包含昵称,头像,code | 56 | + //小程序传递数据,包含昵称,头像,code,是否为苹果用户参数 |
56 | $raw_data = $this->request->post(); | 57 | $raw_data = $this->request->post(); |
57 | //验证表数据 | 58 | //验证表数据 |
58 | $rule = config('verify.user'); | 59 | $rule = config('verify.user'); |
@@ -78,6 +79,7 @@ class User extends Api | @@ -78,6 +79,7 @@ class User extends Api | ||
78 | $ret = $this->auth->login($result); | 79 | $ret = $this->auth->login($result); |
79 | if ($ret) { | 80 | if ($ret) { |
80 | $data = $this->auth->getUserinfo(); | 81 | $data = $this->auth->getUserinfo(); |
82 | + Db::name('user')->where('id',$data['data']['id'])->update(['type'=>$raw_data['type']]); | ||
81 | $this->success('登录成功', $data); | 83 | $this->success('登录成功', $data); |
82 | }else { | 84 | }else { |
83 | $this->error($this->auth->getError()); | 85 | $this->error($this->auth->getError()); |
@@ -9,11 +9,13 @@ return [ | @@ -9,11 +9,13 @@ return [ | ||
9 | 'code' => 'require', | 9 | 'code' => 'require', |
10 | 'nickname' => 'require', | 10 | 'nickname' => 'require', |
11 | 'avatar' => 'require', | 11 | 'avatar' => 'require', |
12 | + 'type' =>'require', | ||
12 | ], | 13 | ], |
13 | 'msg' => [ | 14 | 'msg' => [ |
14 | 'name.require' => '昵称不能为空', | 15 | 'name.require' => '昵称不能为空', |
15 | 'code.require' => 'code码不能为空', | 16 | 'code.require' => 'code码不能为空', |
16 | 'avatar' => '头像不能为空', | 17 | 'avatar' => '头像不能为空', |
18 | + 'type' => '是否为苹果类型不能为空', | ||
17 | ] | 19 | ] |
18 | ], | 20 | ], |
19 | 'path'=>'http://qiniuareial.w.broing.cn', | 21 | 'path'=>'http://qiniuareial.w.broing.cn', |
public/assets/js/backend/iphoneorder.js
0 → 100644
1 | +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { | ||
2 | + | ||
3 | + var Controller = { | ||
4 | + index: function () { | ||
5 | + // 初始化表格参数配置 | ||
6 | + Table.api.init({ | ||
7 | + extend: { | ||
8 | + index_url: 'iphoneorder/index' + location.search, | ||
9 | + add_url: 'iphoneorder/add', | ||
10 | + edit_url: 'iphoneorder/edit', | ||
11 | + del_url: 'iphoneorder/del', | ||
12 | + multi_url: 'iphoneorder/multi', | ||
13 | + table: 'iphoneorder', | ||
14 | + } | ||
15 | + }); | ||
16 | + | ||
17 | + var table = $("#table"); | ||
18 | + | ||
19 | + // 初始化表格 | ||
20 | + table.bootstrapTable({ | ||
21 | + url: $.fn.bootstrapTable.defaults.extend.index_url, | ||
22 | + pk: 'id', | ||
23 | + sortName: 'id', | ||
24 | + columns: [ | ||
25 | + [ | ||
26 | + {checkbox: true}, | ||
27 | + {field: 'id', title: __('Id')}, | ||
28 | + {field: 'user_id', title: __('User_id')}, | ||
29 | + {field: 'money', title: __('Money'), operate:'BETWEEN'}, | ||
30 | + {field: 'status', title: __('支付状态'),searchList: {"1":"","2":'已支付'},formatter: Table.api.formatter.status}, | ||
31 | + {field: 'num', title: __('Num')}, | ||
32 | + {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, | ||
33 | + {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, | ||
34 | + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} | ||
35 | + ] | ||
36 | + ] | ||
37 | + }); | ||
38 | + | ||
39 | + // 为表格绑定事件 | ||
40 | + Table.api.bindevent(table); | ||
41 | + }, | ||
42 | + add: function () { | ||
43 | + Controller.api.bindevent(); | ||
44 | + }, | ||
45 | + edit: function () { | ||
46 | + Controller.api.bindevent(); | ||
47 | + }, | ||
48 | + api: { | ||
49 | + bindevent: function () { | ||
50 | + Form.api.bindevent($("form[role=form]")); | ||
51 | + } | ||
52 | + } | ||
53 | + }; | ||
54 | + return Controller; | ||
55 | +}); |
-
请 注册 或 登录 后发表评论