xieruidong 2 年之前
父節點
當前提交
109ee35bc5

+ 19 - 0
application/admin/controller/Finance.php

@@ -0,0 +1,19 @@
+<?php
+
+namespace app\admin\controller;
+
+use app\common\controller\Backend;
+
+/**
+ * 资讯管理
+ *
+ * @icon fa fa-info
+ */
+class Finance extends Backend
+{
+    public function amount_statistics(){
+        list($time,$timeArr)=$this->rangeTime();
+        $this->assign('time',$time);
+        return $this->fetch();
+    }
+}

+ 10 - 0
application/admin/view/finance/amount_statistics.html

@@ -0,0 +1,10 @@
+<form class="form-inline form" role="form">
+    <div class="form-group">
+        <label for="time">时间段</label>
+        <input type="text" name="time" value="{$time}" class="form-control datetimerange" id="time" placeholder="选择时间" style="width: 300px;">
+    </div>
+    <div class="form-group" style="text-align: right">
+        <button type="submit" class="btn btn-primary doSearch">确定</button>
+    </div>
+    <input type="hidden" name="dialog" value="{:input('dialog')}">
+</form>

+ 6 - 1
application/api/controller/User.php

@@ -318,7 +318,7 @@ class User extends Api
      * @ApiParams (name=sms_code,description="手机验证码,event等于1时需要")
      * @ApiParams (name=event,description="1注册2个人中心绑定3扫码登录")
      * @ApiParams (name=code,description="微信回传的code")
-     * @ApiParams (name=key,description="扫码登录key")
+     * @ApiParams (name=key,description="扫码登录key,扫码登陆时候需要")
      * @ApiReturnParams  (name=bind,description="是否绑定成功")
      * @ApiReturnParams  (name=openid,description="openid")
      * @ApiReturnParams  (name=user,description="用户信息,仅扫码登录有")
@@ -336,6 +336,11 @@ class User extends Api
             $key=$this->auth->getUser()['mobile'];
         }elseif($data['event']==3){
             $key=$data['key'];
+        }else{
+            $key='';
+        }
+        if(empty($key)){
+            $this->error('马苏德');
         }
 
         list($res,$openid)=WxOpenService::bind($key,$data['event']);

+ 7 - 0
application/common/controller/Backend.php

@@ -628,4 +628,11 @@ class Backend extends Controller
             $this->error('操作失败');
         }
     }
+    protected function rangeTime($key='time'){
+        $time=input($key)?:sprintf('%s - %s',date('Y-m-d 00:00:00'),date('Y-m-d 23:59:59'));
+        $timeArr=explode(' - ',$time);
+        $timeArr[0]=strtotime($timeArr[0]);
+        $timeArr[1]=strtotime($timeArr[1]);
+        return [$time,$timeArr];
+    }
 }

+ 20 - 0
public/assets/js/backend/finance.js

@@ -0,0 +1,20 @@
+define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
+
+    var Controller = {
+        amount_statistics: function () {
+            Form.events.daterangepicker($('.form'))
+        },
+        add: function () {
+            Controller.api.bindevent();
+        },
+        edit: function () {
+            Controller.api.bindevent();
+        },
+        api: {
+            bindevent: function () {
+                Form.api.bindevent($("form[role=form]"));
+            }
+        }
+    };
+    return Controller;
+});