mysql导出数据库前查看不需要导出的表

今天从staging上导lendlease的库的时候发现有的表需要很长时间,后开一看system_logs尽然7个多G

mac上的Sequel Pro又不像windows上heidisql那样可以看到每个表的大小

所以需要自己查一下 看看是不是又不需要的表 而且又特别的大

1
SELECT TABLE_NAME, TABLE_ROWS, DATA_LENGTH FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'crm_lendlease' ORDER BY DATA_LENGTH DESC, TABLE_ROWS DESC

image.png

laravel 密码错误

shoptima的项目 安装好了但是登录不进去

https://learnku.com/articles/5963/toggle-laravel-login-default-bcrypt-encryption-validation

跟着这篇文章先了解了laravel login default bcrypt 加密验证的流程

然后在

shoptima_crm/vendor/laravel/framework/src/Illuminate/Auth/EloquentUserProvider.php

public function validateCredentials

在check之前添加如下代码

1
2
3
4
5
6
7
8
9
10
11
        $pwd 'secret';
//        echo $hash = password_hash($pwd, PASSWORD_BCRYPT);exit;
        $hash '$2y$10$sCP.2BFmk74IIJ6ftVT4.uN4BjH092LpvgcFAG7FtSOvT4VmJ0guW';
 
        if (password_verify($pwd,$hash)) {
            echo "密码正确";
        else {
            echo "密码错误";
        }
 
        exit;

然后把password_hash算出的密码 保存到数据库里就可以了

password_hash每次加密过的结果都是不同的 

只有通过password_verify来验证

—————————–

可以使用artisan来做:

1
2
3
4
5
6
7
php artisan tinker
 
$u =App\User::find(1)
 
$u->password=bcrypt('newpassword')
 
$u->save()

—————————–

另外一种方式:

Set mail driver as "log" ( .env file )

click forgot password

get password reset link(mail content) in laravel.log

paste it in browser and reset password.

人人商城多商户菜单修改

今天需要修改人人商城的多商户左侧菜单 

由于不想给商户太多权限 所以需要去除一部分 

找了半天发现尽然是和主模块用的同一个模版

/addons/ewei_shopv2/template/web_v3/_header.html

而且菜单获取的内容和主模块一样去掉的办法很傻 直接在pluginMenu unset, 添加如下内容即可

/addons/ewei_shopv2/core/model/system.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
if($plugin == 'merch'){
            // remove menu for plugins
            unset($config[$key]['perm']);
            unset($config[$key]['plugins']);
            unset($config[$key]['sale']);
            unset($config[$key]['sysset']['items'][1]);
            unset($config[$key]['sysset']['items'][2]);
            unset($config[$key]['shop']['items'][0]['items'][0]);
            unset($config[$key]['shop']['items'][0]['items'][1]);
            unset($config[$key]['shop']['items'][0]['items'][2]);
            unset($config[$key]['shop']['items'][0]['items'][3]);
            unset($config[$key]['shop']['items'][0]['items'][4]);
            unset($config[$key]['shop']['items'][0]['items'][5]);
            $config[$key]['shop']['items'][0] = array('title' => 店铺装修,'route' => diypage,'desc' => 店铺装修, 'top'=>true);
}

微信返佣转账

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//发送红包start
$url 'https://api.mch.weixin.qq.com/mmpaymkttransfers/sendredpack';
 
//获取openID
$uid $list['uid'];
$result  = pdo_fetch("SELECT openid FROM ims_meepo_online_user WHERE id=:id",array(':id'=>$uid));
$open_id $result['openid'];
$money   = (float)$list['money'];
 
$package array();
$package['nonce_str'] = random(8);
$package['mch_billno'] = 'xxx'.rand(10000000000000,99999999999999);
$package['mch_id'] = '1515256111';
$package['wxappid'] = 'wx57a837f1e72026c3';
$package['send_name'] = 'xxxx';
$package['re_openid'] = $open_id;
$package['total_amount'] = $money*100;
$package['total_num'] = 1;
$package['wishing'] = 'xxxx佣金'.date('Y-m-d');
$package['client_ip'] = CLIENT_IP;
$package['act_name'] = 'xxxxx佣金';
$package['remark'] = '根据会员后台提现的金额返佣.';
$package['scene_id'] = 'PRODUCT_5';
 
ksort($package, SORT_STRING);
$string1 '';
foreach($package as $key => $v) {
    if (empty($v)) {
        continue;
    }
    $string1 .= "{$key}={$v}";
}
$string1 .= "key=2nHuHsDijB4Ye7mNN22QxFAP3AW6l3hT";
 
$package['sign'] = strtoupper(md5($string1));
$dat = array2xml($package);
 
load()->func('communication');
 
$certPath 'E:\xxxxx/apiclient_cert.pem';
$keyPath 'E:\xxxxx\cert/apiclient_key.pem';
 
$extra array(
    CURLOPT_SSL_VERIFYPEER=>false,
    CURLOPT_SSL_VERIFYHOST=>false,
    CURLOPT_SSLCERTTYPE=>'PEM',
    CURLOPT_SSLKEYTYPE=>'PEM',
    CURLOPT_SSLCERT=>$certPath,
    CURLOPT_SSLKEY=>$keyPath,
    CURLOPT_POST=>1
);
$response = ihttp_request($url$dat$extra);
 
if($response['errno'] == 58){
    $err_msg $response['message'];
    die(json_encode(error('-1',$err_msg)));
}else{
    $xml $response['content'];
    $result = xml2array($xml);
 
    if($result['result_code'] == 'SUCCESS'){
        $pdo_list = pdo_update("meepo_online_money_page",array('order_static'=>$is_best),array('id'=>$id));
        die(json_encode(error('0','success')));
    }else if($result['result_code'] == 'FAIL'){
        //alert error
        $err_msg $result['return_msg'];
        die(json_encode(error('-1',$err_msg)));
    }
}
 
//exit;
//echo $response;
 
//发送红包end

树莓派 centos 7-aarch64如何替换yum源

之前按网上方法更换源 都有问题 这个试过了是可以的

一、进入yum.repo.d

1
2
3
4
[root@node-01 ~]# cd /etc/yum.repos.d/
  
[root@node-01 yum.repos.d]# ls
CentOS-Base.repo  CentOS-Sources.repo

二、备份原yum源

1
2
3
4
5
6
[root@node-01 yum.repos.d]# mkdir yum-back
  
[root@node-01 yum.repos.d]# mv CentOS-* yum-back/
  
[root@node-01 yum.repos.d]# ls
yum-back

三、替换yum源为阿里源

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
[root@node-01 yum.repos.d]# cat CentOS-Base.repo 
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#
  
[base]
name=CentOS-$releasever - Base
baseurl=https://mirrors.aliyun.com/centos-altarch/$releasever/os/$basearch/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
  
#released updates 
[updates]
name=CentOS-$releasever - Updates
baseurl=https://mirrors.aliyun.com/centos-altarch/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
  
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=https://mirrors.aliyun.com/centos-altarch/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
enabled=1
  
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=https://mirrors.aliyun.com/centos-altarch/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
[root@node-01 yum.repos.d]# cat epel.repo 
[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/epel/7/$basearch
#metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
  
[epel-debuginfo]
name=Extra Packages for Enterprise Linux 7 - $basearch - Debug
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch/debug
baseurl=https://mirrors.tuna.tsinghua.edu.cn/epel/7/$basearch/debug
#metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1
  
[epel-source]
name=Extra Packages for Enterprise Linux 7 - $basearch - Source
#baseurl=http://download.fedoraproject.org/pub/epel/7/SRPMS
baseurl=https://mirrors.tuna.tsinghua.edu.cn/epel/7/SRPMS
#metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1

四、运行yum生成缓存

1
2
3
4
5
[root@node-01 ~]#  yum makecache
  
[root@node-01 ~]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7-aarch64
  
[root@node-01 ~]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

五、验证

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
[root@node-01 ~]# yum -y install gcc-c++
  
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package gcc-c++.aarch64 0:4.8.5-36.el7 will be installed
--> Processing Dependency: libstdc++-devel = 4.8.5-36.el7 for package: gcc-c++-4.8.5-36.el7.aarch64
--> Processing Dependency: libstdc++ = 4.8.5-36.el7 for package: gcc-c++-4.8.5-36.el7.aarch64
--> Processing Dependency: gcc = 4.8.5-36.el7 for package: gcc-c++-4.8.5-36.el7.aarch64
......
......
......
Installed:
  gcc-c++.aarch64 0:4.8.5-36.el7                                                                                                       
  
Dependency Installed:
  cpp.aarch64 0:4.8.5-36.el7    gcc.aarch64 0:4.8.5-36.el7    libmpc.aarch64 0:1.0.1-3.el7    libstdc++-devel.aarch64 0:4.8.5-36.el7   
  
Dependency Updated:
  libgcc.aarch64 0:4.8.5-36.el7              libgomp.aarch64 0:4.8.5-36.el7              libstdc++.aarch64 0:4.8.5-36.el7             
  
Complete

python aliyun myddns

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env python
#coding=utf-8
 
"""
新增域名解析记录,参数说明如下:
<accessKeyId>:填写自己的accessKey,建议使用RAM角色管理的Key
<accessSecret>:填写自己的accessSecret,建议使用RAM角色管理的Secret
 
"""
 
from aliyunsdkcore.client import AcsClient
from aliyunsdkcore.acs_exception.exceptions import ClientException
from aliyunsdkcore.acs_exception.exceptions import ServerException
from leokim_function import *
from check_cnnect_network import *
import os
import time
 
 
while True:
    #判断存放IP的文件是否存在,不存在则创建
    if os.path.exists("./ip"):
        pass
    else:
        wirte_to_file("./ip","0.0.0.0")
 
    client = AcsClient('<accessKeyId>''<accessSecret>''cn-hangzhou')
 
    if(connect_code() == 200):
        #通过函数获取外网ip
        ip = get_internet_ip()
        #print(ip)
    else:
        time.sleep(5)
        continue
 
    #下面开始对比ip,如果ip与之前记录的ip一致,则不执行任何操作,如果ip有变化,则会更新本地存储文件和更新域名解析
    with open("./ip"'r') as f:
        old_ip = f.read()
    if ip == old_ip:
        print("noupdate"+"\nnew_ip:"+ip+"\nold_ip:"+old_ip)
    else:
        #print("update"+"\nnew_ip:"+ip+"\nold_ip:"+old_ip)
        wirte_to_file("./ip",ip)
        des_relsult = Describe_SubDomain_Records(client,"A","rpi.sgl1885.com")
                #判断子域名解析记录查询结果,TotalCount为0表示不存在这个子域名的解析记录,需要新增一个
        if des_relsult["TotalCount"== 0:
            add_relsult = add_record(client,"5","600","A",ip,"rpi","sgl1885.com")
            record_id = add_relsult["RecordId"]
            print("域名解析新增成功!")
        #判断子域名解析记录查询结果,TotalCount为1表示存在这个子域名的解析记录,需要更新解析记录,更新记录需要用到RecordId>,这个在查询函数中有返回des_relsult["DomainRecords"]["Record"][0]["RecordId"]
        elif des_relsult["TotalCount"== 1:
            record_id = des_relsult["DomainRecords"]["Record"][0]["RecordId"]
            update_record(client,"5","600","A",ip,"rpi",record_id)
            print("域名解析更新成功!")
        else:
            record_id = 0
            print("存在两个子域名解析记录值,请核查删除后再操作!")
        path = './RecordId'
        wirte_to_file(path,record_id)
    time.sleep(10)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/usr/bin/env python
#coding=utf-8
 
 
"""
Priority(5):解析优先级,非必填
TTL(600):TTL值,默认600秒,非必填
Value("121.201.65.98"):记录值,必填
request.set_Type("A"):解析类型,A为解析成IPv4,如需解析根域名,填写@,必填
request.set_RR("www"):子域名,必填
request.set_DomainName("xiaoanran.club"):根域名,必填
 
返回值说明:
RecordId:解析记录ID,修改和查询域名时需要用到
RequestId:请求ID
 
"""
from aliyunsdkalidns.request.v20150109.AddDomainRecordRequest import AddDomainRecordRequest
from aliyunsdkalidns.request.v20150109.UpdateDomainRecordRequest import UpdateDomainRecordRequest
from aliyunsdkalidns.request.v20150109.DescribeSubDomainRecordsRequest import DescribeSubDomainRecordsRequest
import urllib
import json
 
#写入文件
def wirte_to_file(path,content):
    with open(path,'w') as f:
        f_name = open(path,'w')
        f_name.write(content)
 
#新增解析记录,返回json格式的数据
def add_record(client,priority,ttl,record_type,value,rr,domainname):
    request = AddDomainRecordRequest()
    request.set_accept_format('json')
 
    request.set_Priority(priority)
    request.set_TTL(ttl)
    request.set_Value(value)
    request.set_Type(record_type)
    request.set_RR(rr)
    request.set_DomainName(domainname)
 
    response = client.do_action_with_exception(request)
    #response = str(response, encoding='utf-8')
    relsult = json.loads(response)
    return relsult
 
#更新解析记录
def update_record(client,priority,ttl,record_type,value,rr,record_id):
    request = UpdateDomainRecordRequest()
    request.set_accept_format('json')
 
    request.set_Priority(priority)
    request.set_TTL(ttl)
    request.set_Value(value)
    request.set_Type(record_type)
    request.set_RR(rr)
    request.set_RecordId(record_id)
 
    response = client.do_action_with_exception(request)
    #response = str(response, encoding='utf-8')
    return response
 
#查询解析记录
def Describe_SubDomain_Records(client,record_type,subdomain):
    request = DescribeSubDomainRecordsRequest()
    request.set_accept_format('json')
 
    request.set_Type(record_type)
    request.set_SubDomain(subdomain)
 
    response = client.do_action_with_exception(request)
    #response = str(response, encoding='utf-8')
    relsult = json.loads(response)
    return relsult
 
#获取外网地址
def get_internet_ip():
    response = urllib.urlopen('http://www.3322.org/dyndns/getip')
    ip = response.read()
    return ip