Plugin Directory

Changeset 2431391


Ignore:
Timestamp:
12/04/2020 10:05:37 AM (5 years ago)
Author:
xunhuweb
Message:

mysql8.0

Location:
wechat-shop-download/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • wechat-shop-download/trunk/includes/abstracts/abstract-wshop-order.php

    r2335161 r2431391  
    305305            $title.=" - ".$order_item->get_title();
    306306            if(count($items)>1){
    307                 $title.='...';
    308             }
    309         }
    310        
    311         return apply_filters('wshop_order_title', $title,$this);
     307                $title.=' ...';
     308            }
     309        }
     310       
     311        return apply_filters('wshop_order_title', $title);
    312312    }
    313313   
     
    619619         
    620620            $status_waitting_payment = apply_filters('wshop_order_waitting_payment_status',$this->get_waitting_order_status(),$this,$transaction_id);         
    621             $status_complete_payment = apply_filters('wshop_order_complete_payment_status', self::Complete,$this,$transaction_id);
     621            $status_complete_payment = apply_filters('wshop_order_complete_payment_status', self::Processing,$this,$transaction_id);
    622622            $status_complete_payment = apply_filters("wshop_order_{$this->obj_type}_complete_payment_status", $status_complete_payment,$this,$transaction_id);
    623623            $status_complete_payment = apply_filters("wshop_order_{$this->section}_complete_payment_status", $status_complete_payment,$this,$transaction_id);
     
    875875    public function order_items_view_admin_order_list_item(){
    876876       echo WShop::instance()->WP->requires(WSHOP_DIR, 'order/order-items-view-admin-order-list-item.php',array(
    877             'order'=>$this
    878         ));
    879     }
    880 
    881     public function order_items_view_my_orders_list_item(){
    882         echo WShop::instance()->WP->requires(WSHOP_DIR, 'order/order-items-view-my-orders-list-item.php',array(
    883877            'order'=>$this
    884878        ));
     
    10121006        }
    10131007       
    1014         try {
    1015             $column =$wpdb->get_row(
    1016                 "select column_name
    1017                 from information_schema.columns
    1018                 where table_name='{$wpdb->prefix}wshop_order'
    1019                 and table_schema ='".DB_NAME."'
     1008        $column =$wpdb->get_row(
     1009           "select column_name
     1010            from information_schema.columns
     1011            where table_name='{$wpdb->prefix}wshop_order'
     1012                    and table_schema ='".DB_NAME."'
    10201013                    and column_name ='class'
    10211014            limit 1;");
    1022            
    1023             if($column&&!empty($column->column_name)){
    1024                 $wpdb->query("ALTER TABLE `{$wpdb->prefix}wshop_order` DROP COLUMN `class`;");
    1025             }
    1026            
     1015       
     1016        if($column&&!empty($column->column_name)){
     1017            $wpdb->query("ALTER TABLE `{$wpdb->prefix}wshop_order` DROP COLUMN `class`;");
     1018        }
     1019       
     1020        if(!empty($wpdb->last_error)){
     1021            WShop_Log::error($wpdb->last_error);
     1022            throw new Exception($wpdb->last_error);
     1023        }
     1024       
     1025        $column =$wpdb->get_row(
     1026           "select column_name
     1027            from information_schema.columns
     1028            where table_name='{$wpdb->prefix}wshop_order'
     1029                    and table_schema ='".DB_NAME."'
     1030                    and column_name ='exchange_rate'
     1031            limit 1;");
     1032        if(!$column||empty($column->COLUMN_NAME)&&empty($column->column_name)){
     1033            $wpdb->query("alter table `{$wpdb->prefix}wshop_order` add column `exchange_rate` DECIMAL(18,4) NOT NULL DEFAULT '0.0000';");
     1034        }
     1035       
     1036        if(!empty($wpdb->last_error)){
     1037            WShop_Log::error($wpdb->last_error);
     1038            throw new Exception($wpdb->last_error);
     1039        }
     1040       
     1041       
     1042        $column =$wpdb->get_row(
     1043            "select column_name
     1044            from information_schema.columns
     1045            where table_name='{$wpdb->prefix}wshop_order'
     1046            and table_schema ='".DB_NAME."'
     1047                    and column_name ='cookie_id'
     1048            limit 1;");
     1049       
     1050        if(!$column||empty($column->COLUMN_NAME)&&empty($column->column_name)){
     1051            $wpdb->query("alter table `{$wpdb->prefix}wshop_order` add column `cookie_id` VARCHAR(32) NULL DEFAULT NULL;");
     1052        }
     1053       
     1054        if(!empty($wpdb->last_error)){
     1055            WShop_Log::error($wpdb->last_error);
     1056            throw new Exception($wpdb->last_error);
     1057        }
     1058       
     1059        if($wpdb->get_var("show index from `{$wpdb->prefix}wshop_order` where Column_name='cookie_id' and Key_name='cookie_id_key'")!= "{$wpdb->prefix}wshop_order"){
     1060            $wpdb->query ( "ALTER TABLE `{$wpdb->prefix}wshop_order` ADD INDEX cookie_id_key(cookie_id);" );
    10271061            if(!empty($wpdb->last_error)){
    10281062                WShop_Log::error($wpdb->last_error);
    10291063                throw new Exception($wpdb->last_error);
    10301064            }
    1031         } catch (Exception $e) {
    1032         }
    1033        
    1034         try {
    1035             $column =$wpdb->get_row(
    1036                 "select column_name
    1037                 from information_schema.columns
    1038                 where table_name='{$wpdb->prefix}wshop_order'
    1039                 and table_schema ='".DB_NAME."'
    1040                     and column_name ='exchange_rate'
    1041             limit 1;");
    1042            
    1043             if(!$column||empty($column->column_name)){
    1044                 $wpdb->query("alter table `{$wpdb->prefix}wshop_order` add column `exchange_rate` DECIMAL(18,4) NOT NULL DEFAULT '0.0000';");
    1045             }
    1046            
    1047             if(!empty($wpdb->last_error)){
    1048                 WShop_Log::error($wpdb->last_error);
    1049                 throw new Exception($wpdb->last_error);
    1050             }
    1051         } catch (Exception $e) {
    1052         }
    1053        
    1054        
    1055         try {
    1056             $column =$wpdb->get_row(
    1057                 "select column_name
    1058                 from information_schema.columns
    1059                 where table_name='{$wpdb->prefix}wshop_order'
    1060                 and table_schema ='".DB_NAME."'
    1061                     and column_name ='cookie_id'
    1062             limit 1;");
    1063            
    1064             if(!$column||empty($column->column_name)){
    1065                 $wpdb->query("alter table `{$wpdb->prefix}wshop_order` add column `cookie_id` VARCHAR(32) NULL DEFAULT NULL;");
    1066             }
    1067            
    1068             if(!empty($wpdb->last_error)){
    1069                 WShop_Log::error($wpdb->last_error);
    1070                 throw new Exception($wpdb->last_error);
    1071             }
    1072         } catch (Exception $e) {
    1073         }
    1074        
    1075         try {
    1076             if($wpdb->get_var("show index from `{$wpdb->prefix}wshop_order` where Column_name='cookie_id' and Key_name='cookie_id_key'")!= "{$wpdb->prefix}wshop_order"){
    1077                 $wpdb->query ( "ALTER TABLE `{$wpdb->prefix}wshop_order` ADD INDEX cookie_id_key(cookie_id);" );
    1078                 if(!empty($wpdb->last_error)){
    1079                     WShop_Log::error($wpdb->last_error);
    1080                     throw new Exception($wpdb->last_error);
    1081                 }
    1082             }
    1083         } catch (Exception $e) {
    1084         }
    1085        
    1086         try {
    1087             $column =$wpdb->get_row(
    1088                 "select column_name
    1089                 from information_schema.columns
    1090                 where table_name='{$wpdb->prefix}wshop_order'
    1091                 and table_schema ='".DB_NAME."'
     1065        }
     1066       
     1067        $column =$wpdb->get_row(
     1068            "select column_name
     1069            from information_schema.columns
     1070            where table_name='{$wpdb->prefix}wshop_order'
     1071                  and table_schema ='".DB_NAME."'
    10921072                  and column_name ='obj_type'
    10931073            limit 1;");
    1094            
    1095             if(!$column||empty($column->column_name)){
    1096                 $wpdb->query("alter table `{$wpdb->prefix}wshop_order` add column `obj_type` VARCHAR(64) NULL DEFAULT NULL;");
    1097             }
    1098            
    1099             if(!empty($wpdb->last_error)){
    1100                 WShop_Log::error($wpdb->last_error);
    1101                 throw new Exception($wpdb->last_error);
    1102             }
    1103         } catch (Exception $e) {
    1104         }
    1105        
    1106         try {
    1107             $column =$wpdb->get_row(
    1108                 "select column_name
    1109                 from information_schema.columns
    1110                 where table_name='{$wpdb->prefix}wshop_order'
    1111                 and table_schema ='".DB_NAME."'
     1074       
     1075        if(!$column||empty($column->COLUMN_NAME)&&empty($column->column_name)){
     1076            $wpdb->query("alter table `{$wpdb->prefix}wshop_order` add column `obj_type` VARCHAR(64) NULL DEFAULT NULL;");
     1077        }
     1078       
     1079        if(!empty($wpdb->last_error)){
     1080            WShop_Log::error($wpdb->last_error);
     1081            throw new Exception($wpdb->last_error);
     1082        }
     1083       
     1084        $column =$wpdb->get_row(
     1085            "select column_name
     1086            from information_schema.columns
     1087            where table_name='{$wpdb->prefix}wshop_order'
     1088            and table_schema ='".DB_NAME."'
    11121089                  and column_name ='section'
    11131090            limit 1;");
    1114            
    1115             if(!$column||empty($column->column_name)){
    1116                 $wpdb->query("alter table `{$wpdb->prefix}wshop_order` add column `section` VARCHAR(64) NULL DEFAULT NULL;");
    1117             }
    1118            
    1119             if(!empty($wpdb->last_error)){
    1120                 WShop_Log::error($wpdb->last_error);
    1121                 throw new Exception($wpdb->last_error);
    1122             }
    1123         } catch (Exception $e) {
     1091       
     1092        if(!$column||empty($column->COLUMN_NAME)&&empty($column->column_name)){
     1093            $wpdb->query("alter table `{$wpdb->prefix}wshop_order` add column `section` VARCHAR(64) NULL DEFAULT NULL;");
     1094        }
     1095       
     1096        if(!empty($wpdb->last_error)){
     1097            WShop_Log::error($wpdb->last_error);
     1098            throw new Exception($wpdb->last_error);
    11241099        }
    11251100       
     
    11721147            throw new Exception($wpdb->last_error);
    11731148        }
    1174         try {
    1175             $column =$wpdb->get_row(
    1176                 "select column_name
    1177                 from information_schema.columns
    1178                 where table_name='{$wpdb->prefix}wshop_shopping_carts'
    1179                 and table_schema ='".DB_NAME."'
     1149        $column =$wpdb->get_row(
     1150            "select column_name
     1151            from information_schema.columns
     1152            where table_name='{$wpdb->prefix}wshop_shopping_carts'
     1153            and table_schema ='".DB_NAME."'
    11801154                    and column_name ='obj_type'
    11811155            limit 1;");
    1182            
    1183             if(!$column||empty($column->column_name)){
    1184                 $wpdb->query("alter table `{$wpdb->prefix}wshop_shopping_carts` add column `obj_type` VARCHAR(64) NULL DEFAULT NULL;");
    1185             }
    1186            
    1187             if(!empty($wpdb->last_error)){
    1188                 WShop_Log::error($wpdb->last_error);
    1189                 throw new Exception($wpdb->last_error);
    1190             }
    1191         } catch (Exception $e) {
    1192         }
    1193        
    1194        try {
    1195            $column =$wpdb->get_row(
    1196                "select column_name
    1197                from information_schema.columns
    1198                where table_name='{$wpdb->prefix}wshop_shopping_carts'
    1199                and table_schema ='".DB_NAME."'
     1156       
     1157        if(!$column||empty($column->COLUMN_NAME)&&empty($column->column_name)){
     1158            $wpdb->query("alter table `{$wpdb->prefix}wshop_shopping_carts` add column `obj_type` VARCHAR(64) NULL DEFAULT NULL;");
     1159        }
     1160       
     1161        if(!empty($wpdb->last_error)){
     1162            WShop_Log::error($wpdb->last_error);
     1163            throw new Exception($wpdb->last_error);
     1164        }
     1165       
     1166        $column =$wpdb->get_row(
     1167           "select column_name
     1168            from information_schema.columns
     1169            where table_name='{$wpdb->prefix}wshop_shopping_carts'
     1170            and table_schema ='".DB_NAME."'
    12001171                    and column_name ='order_id'
    12011172            limit 1;");
    1202            
    1203            if(!$column||empty($column->column_name)){
    1204                $wpdb->query("alter table `{$wpdb->prefix}wshop_shopping_carts` add column `order_id` BIGINT(20) NULL DEFAULT NULL;");
    1205            }
    1206            
    1207            if(!empty($wpdb->last_error)){
    1208                WShop_Log::error($wpdb->last_error);
    1209                throw new Exception($wpdb->last_error);
    1210            }
    1211        } catch (Exception $e) {
    1212        }
    1213        
    1214         try {
    1215             $column =$wpdb->get_row(
    1216                 "select column_name
    1217                 from information_schema.columns
    1218                 where table_name='{$wpdb->prefix}wshop_shopping_carts'
    1219                 and table_schema ='".DB_NAME."'
     1173       
     1174        if(!$column||empty($column->COLUMN_NAME)&&empty($column->column_name)){
     1175            $wpdb->query("alter table `{$wpdb->prefix}wshop_shopping_carts` add column `order_id` BIGINT(20) NULL DEFAULT NULL;");
     1176        }
     1177       
     1178        if(!empty($wpdb->last_error)){
     1179            WShop_Log::error($wpdb->last_error);
     1180            throw new Exception($wpdb->last_error);
     1181        }
     1182       
     1183        $column =$wpdb->get_row(
     1184            "select column_name
     1185            from information_schema.columns
     1186            where table_name='{$wpdb->prefix}wshop_shopping_carts'
     1187            and table_schema ='".DB_NAME."'
    12201188                    and column_name ='payment_method'
    12211189            limit 1;");
    1222            
    1223             if(!$column||empty($column->column_name)){
    1224                 $wpdb->query("alter table `{$wpdb->prefix}wshop_shopping_carts` add column `payment_method` varchar(64) NULL DEFAULT NULL;");
    1225             }
    1226            
    1227             if(!empty($wpdb->last_error)){
    1228                 WShop_Log::error($wpdb->last_error);
    1229                 throw new Exception($wpdb->last_error);
    1230             }
    1231         } catch (Exception $e) {
     1190       
     1191        if(!$column||empty($column->COLUMN_NAME)&&empty($column->column_name)){
     1192            $wpdb->query("alter table `{$wpdb->prefix}wshop_shopping_carts` add column `payment_method` varchar(64) NULL DEFAULT NULL;");
     1193        }
     1194       
     1195        if(!empty($wpdb->last_error)){
     1196            WShop_Log::error($wpdb->last_error);
     1197            throw new Exception($wpdb->last_error);
    12321198        }
    12331199       
  • wechat-shop-download/trunk/includes/abstracts/abstract-wshop-product.php

    r2335161 r2431391  
    2020       
    2121        $this->post = new WP_Post($this);
    22 
    23         if(!isset($this->sale_price)||is_null($this->sale_price) ||$this->sale_price===''){
    24             $this->sale_price=WShop_Settings_Default_Basic_Default::instance()->get_option('default_price');
    25         }
    2622    }
    2723 
     
    7874       
    7975        $thumb= $thumbnail_id?wp_get_attachment_image_src($thumbnail_id, 'thumbnail'):null;
    80        
     76         
    8177        return apply_filters('wshop_product_img', $thumb&&count($thumb)>0?$thumb[0]:WSHOP_URL.'/assets/image/default.png',$this);
    8278    }
     
    119115            throw new Exception('post is not loaded!');
    120116        }
    121 
     117   
    122118        $osale_price =  isset($this->sale_price)? round(floatval($this->sale_price),2):0.00;
    123         $sale_price=$osale_price =apply_filters('wshop_product_single_price',$osale_price,$this->post,$this);
     119        $sale_price=$osale_price =apply_filters('wshop_product_single_price',$osale_price,$this->post,$this); 
    124120       
    125121        if($symbol){
     
    193189            throw new Exception($wpdb->last_error);
    194190        }
    195         try {
    196 
    197             $column =$wpdb->get_row(
    198                 "select column_name
    199                 from information_schema.columns
    200                 where table_name='{$wpdb->prefix}wshop_product'
    201                 and table_schema ='".DB_NAME."'
     191       
     192        $column =$wpdb->get_row(
     193           "select column_name
     194            from information_schema.columns
     195            where table_name='{$wpdb->prefix}wshop_product'
     196                    and table_schema ='".DB_NAME."'
    202197                    and column_name ='inventory'
    203198            limit 1;");
    204            
    205             if(!$column||empty($column->column_name)){
    206                 $wpdb->query("alter table `{$wpdb->prefix}wshop_product` add column `inventory` int(11) NULL DEFAULT NULL;");
    207             }
    208             if(!empty($wpdb->last_error)){
    209                 WShop_Log::error($wpdb->last_error);
    210                 throw new Exception($wpdb->last_error);
    211             }
    212         } catch (Exception $e) {
    213         }
    214        
    215         try {
    216             $column =$wpdb->get_row(
    217                 "select column_name
    218                 from information_schema.columns
    219                 where table_name='{$wpdb->prefix}wshop_product'
    220                 and table_schema ='".DB_NAME."'
     199       
     200        if(!$column||empty($column->COLUMN_NAME)&&empty($column->column_name)){
     201            $wpdb->query("alter table `{$wpdb->prefix}wshop_product` add column `inventory` int(11) NULL DEFAULT NULL;");
     202        }
     203        if(!empty($wpdb->last_error)){
     204            WShop_Log::error($wpdb->last_error);
     205            throw new Exception($wpdb->last_error);
     206        }
     207       
     208        $column =$wpdb->get_row(
     209           "select column_name
     210            from information_schema.columns
     211            where table_name='{$wpdb->prefix}wshop_product'
     212            and table_schema ='".DB_NAME."'
    221213                                and column_name ='sale_qty'
    222214                        limit 1;");
    223            
    224             if(!$column||empty($column->column_name)){
    225                 $wpdb->query("alter table `{$wpdb->prefix}wshop_product` add column `sale_qty` int(11) NOT NULL DEFAULT 0;");
    226             }
    227             if(!empty($wpdb->last_error)){
    228                 WShop_Log::error($wpdb->last_error);
    229                 throw new Exception($wpdb->last_error);
    230             }
    231         } catch (Exception $e) {
     215       
     216        if(!$column||empty($column->COLUMN_NAME)&&empty($column->column_name)){
     217            $wpdb->query("alter table `{$wpdb->prefix}wshop_product` add column `sale_qty` int(11) NOT NULL DEFAULT 0;");
     218        }
     219        if(!empty($wpdb->last_error)){
     220            WShop_Log::error($wpdb->last_error);
     221            throw new Exception($wpdb->last_error);
    232222        }
    233223       
  • wechat-shop-download/trunk/includes/admin/menus/class-wshop-menu-order-default.php

    r2335161 r2431391  
    675675            return;
    676676        }
    677          
     677       
    678678        check_admin_referer( 'bulk-' . $this->_args['plural'] );
    679679         
    680680        $order_ids   = isset($_POST['order_ids'])?$_POST['order_ids']:null;;
    681         if(!$order_ids||!is_array($order_ids)){
     681        if($bulk_action =='empty_trash' || $bulk_action=='empty_canceled'){
     682            $order_ids=array('0'=>time());
     683        }
     684       
     685        if(!$order_ids ||!is_array($order_ids)){
    682686            return;
    683687        }
     
    776780            $views[$key] ="<a class=\"{$now}\" href=\"{$page_now}&status={$key}\">{$data['title']} <span class=\"count\">(<span>{$data['count']}</span>)</span></a>";
    777781        }
    778          
    779782        return $views;
    780783    }
     
    984987                'restore' => esc_html__( 'Restore', WSHOP ),
    985988                'delete' => esc_html__( 'Delete permanently', WSHOP ),
     989                'empty_trash'=>esc_html__( 'Empty Trash', WSHOP ),
    986990            );
    987991        }
     
    992996            'mark_complete' => esc_html__( 'Mark as Complete', WSHOP ),
    993997            'mark_canceled' => esc_html__( 'Mark as Canceled', WSHOP ),
    994             'mark_pending' => esc_html__( 'Mark as Pending', WSHOP )
     998            'mark_pending' => esc_html__( 'Mark as Pending', WSHOP ),
     999            'empty_canceled'=>esc_html__( 'Empty Canceled', WSHOP )
    9951000        );
    9961001    }
  • wechat-shop-download/trunk/includes/shop/class-wshop-order.php

    r1910155 r2431391  
    160160   
    161161    public static function update_order($order_id,$action){
    162         $order = WShop::instance()->payment->get_order('id',$order_id);
    163         if(!$order){
    164             return WShop_Error::err_code(404);
    165         }
    166          
     162        if($action!='empty_trash' && $action!='empty_canceled'){
     163            $order = WShop::instance()->payment->get_order('id',$order_id);
     164            if(!$order){
     165                return WShop_Error::err_code(404);
     166            }
     167        }
    167168        try {
    168169            global $wpdb;
     
    188189                    }
    189190                    break;
     191                case 'empty_trash':
     192                    $wpdb->delete("{$wpdb->prefix}wshop_order",array(
     193                        'removed'=>'1'
     194                    ));
     195
     196                    if(!empty($wpdb->last_error)){
     197                        throw new Exception($wpdb->last_error);
     198                    }
     199                    break;
     200                case 'empty_canceled':
     201                    $wpdb->delete("{$wpdb->prefix}wshop_order",array(
     202                        'status'=>'canceled'
     203                    ));
     204
     205                    if(!empty($wpdb->last_error)){
     206                        throw new Exception($wpdb->last_error);
     207                    }
     208                    break;
    190209                case 'trash':
    191210                    $wpdb->update("{$wpdb->prefix}wshop_order", array(
  • wechat-shop-download/trunk/readme.txt

    r2372705 r2431391  
    7070
    7171== Changelog ==
     72= v1.1.0 (2020-11-11)
     73* 兼容mysql8.0
    7274
     75= v1.1.0 (2020-10-23)
     76* 后台订单列表,新增清空回收站功能,把多余的数据一键清理
     77
     78= v1.1.0 (2020-07-20)
     79* 新增,多个下载地址,提取码点击按钮复制
     80* 去掉打赏扩展授权
     81* 修复:销售统计,仅管理员可见
    7382= v1.1.0
    7483* 全新界面升级
Note: See TracChangeset for help on using the changeset viewer.