afa 7 months ago
parent
commit
488dc257a2

+ 2 - 2
application/common/model/ProductOrder.php

@@ -45,7 +45,6 @@ class ProductOrder extends Model
     const Buying            = 7; //求购
     
     // 订单状态 '已下单', 1=>'已付款', 2=>'已转让', 3=>'提货', 4=>'已取消', 5=>'完成'];
-    
     public $order_status = [
         '-1'                    => '全部',
         self::Paid              => '已付款',
@@ -182,7 +181,7 @@ class ProductOrder extends Model
     
     public static function getStatusList()
     {
-        return [self::Ordered => __('已下单'), self::Paid  => __('已付款'), self::Transferred => __('已转让'), 
+        return [self::Paid  => __('已付款'), self::Transferred => __('已转让'), 
         self::Shipped => __('提货'), self::Cancelled  => __('已取消'), self::Closure => __('关闭'), self::Freeze => __('质押')];
     }
 
@@ -191,6 +190,7 @@ class ProductOrder extends Model
     {
         return [
             ['type_id'=>self::Popular,  'status'=> self::Paid,     'text' => __('已购买')],
+            ['type_id'=>self::Popular,  'status'=> self::Closure,  'text' => __('已关闭')],
             ['type_id'=>self::Transfer, 'status'=> self::Transferred,'text' => __('转让中')],
             ['type_id'=>self::Giveaway, 'status'=> self::Closure, 'text' => __('已赠送')],
             ['type_id'=>self::Transfer, 'status'=> self::Closure, 'text' => __('已转让')], 

+ 133 - 0
application/common/model/UserOperateLog.php

@@ -0,0 +1,133 @@
+<?php
+
+namespace app\common\model;
+
+use think\Model;
+
+//操作记录
+class UserOperateLog extends Model
+{
+
+    // 表名
+    protected $table = 'user_operate_log';
+    
+    // 自动写入时间戳字段
+    protected $autoWriteTimestamp = 'int';
+
+    // 定义时间戳字段名
+    protected $createTime = 'create_time';
+    protected $updateTime = 'update_time';
+    protected $deleteTime = false;
+
+    // 追加属性
+    protected $append = [
+        'create_time_text',
+        'update_time_text',
+        'start_time_text',
+    ];
+    
+    //操作
+    const Purchased      = 0;
+    const Transferred    = 1;
+    const Giveaway       = 2;
+    const Transfer       = 3;
+    const Delivery       = 4;
+    const TranCancel     = 5;
+    const Pledge         = 6;
+    const BuyTran        = 7;
+    const Airdrop        = 8;
+    const AirdClose      = 9;
+    const Synthesi       = 10;
+    const SyntClose      = 11;
+    const Buying         = 12;
+    const BuyClose       = 13;
+    const Newbie         = 14;
+    const NewClose       = 15;
+    const Super          = 16;
+    const SupClose       = 17;
+
+    //操作说明
+    public static function getActionAll()
+    {
+        return [
+            ['value'=>self::Purchased,  'name' => __('已购买')],
+            ['value'=>self::Transferred, 'name' => __('转让中')],
+            ['value'=>self::Giveaway, 'name' => __('已赠送')],
+            ['value'=>self::Transfer,  'name' => __('已转让')], 
+            ['value'=>self::Delivery,  'name' => __('已提货')],
+            ['value'=>self::TranCancel ,'name' => __('取消转让')],
+            ['value'=>self::Pledge,    'name' => __('质押')],
+            ['value'=>self::BuyTran,   'name' => __('购买寄售')],
+            ['value'=>self::Airdrop,  'name' => __('空投')],
+            ['value'=>self::AirdClose,  'name' => __('空投关闭')],
+            ['value'=>self::Synthesi,  'name' => __('合成')],
+            ['value'=>self::SyntClose, 'name' => __('合成关闭')],
+            ['value'=>self::Buying,  'name' => __('求购')],
+            ['value'=>self::BuyClose,  'name' => __('求购关闭')],
+            ['value'=>self::Newbie, 'name' => __('新人茶权')],
+            ['value'=>self::Newbie, 'name' => __('新人茶权关闭')],
+            ['value'=>self::NewClose,  'name' => __('新人福利')],
+            ['value'=>self::SupClose, 'name' => __('新人福利关闭')],
+        ];
+    }
+
+    //操作记录
+    public static function setCreateOperateLog(int $userId, int $action, int $productId, string $area)
+    {
+        return self::create([
+            'user_id'       => $userId,
+            'action'        => $action,
+            'product_id'    => $productId,
+            'area'          => $area,
+        ]);
+    }
+
+
+    
+    //
+    public function product()
+    {
+        return $this->hasOne('ProductLists', 'id', 'product_id', [], 'LEFT')->setEagerlyType(0);
+    }
+
+    public function users()
+    {
+        return $this->hasOne('UserModel', 'id', 'user_id', [], 'LEFT')->setEagerlyType(0);
+    }
+
+
+    public function getCreateTimeTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['create_time']) ? $data['create_time'] : '');
+        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
+    }
+
+
+    public function getUpdateTimeTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['update_time']) ? $data['update_time'] : '');
+        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
+    }
+
+    protected function setCreateTimeAttr($value)
+    {
+        return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
+    }
+
+    protected function setUpdateTimeAttr($value)
+    {
+        return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
+    }
+
+    
+    public function getStartTimeTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['start_time']) ? $data['start_time'] : '');
+        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
+    }
+    protected function setStartTimeAttr($value)
+    {
+        return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
+    }
+
+}

+ 19 - 1
public/assets/js/backend/user/airdrop.js

@@ -46,7 +46,25 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
             Table.api.bindevent(table);
         },
         add: function () {
-            Controller.api.bindevent();
+            Form.api.bindevent($("form[role=form]"), function () {
+            }, function () {
+            }, function (success, error) {
+                    layer.confirm('请先仔细检查后操作!!', {
+                        btn: ['确定', '取消'] //按钮
+                    }, function (index) {
+                        Form.api.submit($("form[role=form]"), function (data, ret) {
+                            //如果我们需要在提交表单成功后做跳转,可以在此使用location.href="链接";进行跳转
+                            setTimeout(function () {
+                                parent.Layer.close(parent.Layer.getFrameIndex(window.name));
+                                //刷新页面
+                                window.parent.location.reload();
+                            }, 1000);
+                        });
+                        Layer.close(index);
+                    }, function () {
+                    });
+                    return false;
+            });
         },
         edit: function () {
             Controller.api.bindevent();