Пример #1
0
    def sync_member_personal_information(self):
        # TODO  'sync_member_personal_information'
        db = self.env['bn.db.connect'].search([('store_code', '=', 'bncard')])

        mem_list = self.get_personal_recordset(Bnc_Mysql_SQLCa(db[0]))
        for (mobile, bu_name, wxid, unionid, openid, nickname, sex, birthday,
             email, province, city, address, vip_level_name, agent,
             stamp) in mem_list:

            member = self.env['bnc.member'].search([('strPhone', '=', mobile)])
            if member:
                val = {
                    'wxid': wxid,
                    'unionid': unionid,
                    'openid': openid,
                    'nickname': nickname,
                    'agent': agent,
                    'bu_name': bu_name,
                    'strEMail': email,
                    'province': province,
                    'city': city,
                    'address': address,
                    # 'vip_level_name': vip_level_name,
                    'strSex': str(sex),
                    'Birthday': birthday,
                    'mysqlstamp': stamp,
                }
                _logger.info("sync_member_personal_information:" + "/" +
                             " the phones is =>  " + mobile)
                member[0].write(val)
        return True
Пример #2
0
    def sync_mg_weixinfans_2_bnc(self):
        # TODO  'sync_mg_weixinfans_2_bnc'
        db = self.env['bn.db.connect'].search([('store_code', '=', 'mgjspot')])
        mem_list = self.get_mg_weixinfans(Bnc_Mysql_SQLCa(db[0]))
        # mem_list = self.get_personal_integral_weixin_test(Bnc_Mysql_SQLCa(db[0]))
        i = 0
        for (id, wxid, openid, nickname, sex, province, city, country,
             headimgurl, unionid, subscribe_time_dt, subscribe, groupid,
             tagid_list, addtime, lasttime, last_baseauth_time, is_rec_msg,
             from_xcx, tags) in mem_list:

            i = i + 1

            # member = self.env['bnc.member'].search([('strPhone', '=', phone)])
            #
            # if member:
            #     bnc_member_id = member[0].id
            # else:
            #     bnc_member_id = None

            val = {
                'lng_mg_id': id,
                'wxid': wxid,
                'openid': openid,
                'nickname': nickname,
                'sex': sex,
                'province': province,
                'city': city,
                'country': country,
                'headimgurl': headimgurl,
                'unionid': unionid,
                'subscribe_time_dt': subscribe_time_dt,
                'subscribe': subscribe,
                'groupid': groupid,
                'tagid_list': tagid_list,
                'addtime': addtime,
                'lasttime': lasttime,
                'last_baseauth_time': last_baseauth_time,
                'is_rec_msg': is_rec_msg,
                'tags': tags
            }
            mem_c = self.env['bnc.mg.weixinfans'].search([('lng_mg_id', '=',
                                                           id)])
            if mem_c:
                mem_c.write(val)
            else:
                self.env['bnc.mg.weixinfans'].create(val)
                self.env.cr.commit()

            # print("sync_guidecustomer':" + str(id) + "====>" + str(i) + "/" + str(len(mem_list)))

            if i % 100 == 0:
                _logger.info("sync_bnc.mg.weixinfans':" + str(id) + "====>" +
                             str(i) + "/" + str(len(mem_list)))
        return True
Пример #3
0
    def sync_member_personal_integral_weixin(self):
        # TODO  'sync_member_personal_integral_weixin'
        db = self.env['bn.db.connect'].search([('store_code', '=', 'bncard')])
        mem_list = self.get_personal_integral_weixin(Bnc_Mysql_SQLCa(db[0]))
        # mem_list = self.get_personal_integral_weixin_test(Bnc_Mysql_SQLCa(db[0]))
        i = 0
        for (ieid, mobile, name, teg_id, teg_name, type_name, integral,
             discount, validity_type, up_begin, up_end, addtime, vali_begin,
             vali_end, serial, statu, dt_endtime, stamp) in mem_list:

            print i, len(mem_list), mobile
            i = i + 1

            member = self.env['bnc.member'].search([('strPhone', '=', mobile)])
            if member:
                bnc_member_id = member[0].id
            else:
                bnc_member_id = None
            val = {
                'intIeId': ieid,
                'strPhone': mobile,
                'strName': name,
                'intTegId': teg_id,
                'strTegName': teg_name,
                'strTypeName': type_name,
                'intIntegral': integral,
                'intDiscount': discount,
                'intValidityType': validity_type,
                'up_begin': up_begin,
                'up_end': up_end,
                'valid_begin': vali_begin,
                'valid_end': vali_end,
                'strSerial': serial,
                'strStatus': statu,
                'Addtime': addtime,
                'Endtime': dt_endtime,
                'timestamp': stamp,
                'belong_bnc_member': bnc_member_id,
            }
            mem_c = self.env['bnc.mobile.integral'].search([('intIeId', '=',
                                                             ieid)])
            if mem_c:
                mem_c.write(val)
            else:
                self.env['bnc.mobile.integral'].create(val)
            _logger.info("sync_member_personal_integral_weixin':" + "/" +
                         " the phones is =>  " + mobile)
        return True
Пример #4
0
    def sync_mg_customer_2_bnc(self):
        # TODO  'sync_mg_customer_2_bnc'
        db = self.env['bn.db.connect'].search([('store_code', '=', 'mgjspot')])
        mem_list = self.get_mg_guide_customer(Bnc_Mysql_SQLCa(db[0]))
        # mem_list = self.get_personal_integral_weixin_test(Bnc_Mysql_SQLCa(db[0]))
        i = 0
        for (id, guide_id, manager_id, customer_openid, addtime, realname,
             gender, phone, province, city, area, tags) in mem_list:

            i = i + 1

            member = self.env['bnc.member'].search([('strPhone', '=', phone)])

            if member:
                bnc_member_id = member[0].id
            else:
                bnc_member_id = None

            val = {
                'lng_mg_id': id,
                'guide_id': guide_id,
                'manager_id': manager_id,
                'customer_openid': customer_openid,
                'addtime': addtime,
                'realname': realname,
                'gender': gender,
                'phone': phone,
                'province': province,
                'city': city,
                'area': area,
                'tags': tags
            }
            mem_c = self.env['bnc.mg.guidecustomer'].search([('lng_mg_id', '=',
                                                              id)])
            if mem_c:
                mem_c.write(val)
            else:
                self.env['bnc.mg.guidecustomer'].create(val)
                self.env.cr.commit()

            # print("sync_guidecustomer':" + str(id) + "====>" + str(i) + "/" + str(len(mem_list)))

            if i % 100 == 0:
                _logger.info("sync_guidecustomer':" + str(id) + "====>" +
                             str(i) + "/" + str(len(mem_list)))
        return True
Пример #5
0
    def sync_member_personal_mp_weixin(self):
        # TODO  'sync_member_personal_mp_weixin'
        db = self.env['bn.db.connect'].search([('store_code', '=', 'bncard')])
        mem_list = self.get_personal_mp_weixin(Bnc_Mysql_SQLCa(db[0]))
        for (mobile, reg, bu_id, bu_name, shopid, codeid, stamp) in mem_list:
            print mobile
            print bu_id
            member = self.env['bnc.member'].search([('strPhone', '=', mobile)])

            if member:

                bnc_member_id = member[0].id
                # bnc_member_id = member.id
            else:
                bnc_member_id = None

            company = self.env['res.company'].search([('mp_bucode', '=', bu_id)
                                                      ])
            if company:
                bnc_company_id = company[0].id
            else:
                bnc_company_id = None

            seek_mobile = self.env['bnc.mobile.bu'].search([('strPhone', '=',
                                                             mobile)])
            val = {
                'strPhone': mobile,
                'RegDate': reg,
                'strBuId': bu_id,
                'strBuName': bu_name,
                'strshopid': shopid,
                'strcodeid': codeid,
                'timestamp': stamp,
                'belong_bnc_member': bnc_member_id,
                'belong_company': bnc_company_id,
            }

            if seek_mobile:
                _logger.info("sync_member_personal_mp_weixin':" + "/" +
                             " the phones is =>  " + mobile)
                seek_mobile[0].write(val)
            else:
                self.env['bnc.mobile.bu'].create(val)

        return True
Пример #6
0
    def sync_mg_2_bnc(self):
        # TODO  'sync_mg_2_bnc'
        db = self.env['bn.db.connect'].search([('store_code', '=', 'mgjspot')])
        mem_list = self.get_mg_guide_info(Bnc_Mysql_SQLCa(db[0]))
        # mem_list = self.get_personal_integral_weixin_test(Bnc_Mysql_SQLCa(db[0]))
        i = 0
        for (id, realname, nickname, gender, phone, password, province, city,
             area, addtime) in mem_list:

            i = i + 1

            member = self.env['bnc.member'].search([('strPhone', '=', phone)])

            if member:
                bnc_member_id = member[0].id
            else:
                bnc_member_id = None

            val = {
                'lng_mg_id': id,
                'realname': realname,
                'nickname': nickname,
                'gender': gender,
                'phone': phone,
                'password': password,
                'province': province,
                'city': city,
                'area': area,
                'addtime': addtime
            }
            mem_c = self.env['bnc.mg.guideinfo'].search([('lng_mg_id', '=', id)
                                                         ])
            if mem_c:
                mem_c.write(val)
            else:
                self.env['bnc.mg.guideinfo'].create(val)
            _logger.info("sync_guideinfo':" + "/" + " the phones is =>  " +
                         phone)
        return True
Пример #7
0
    def sync_member_personal_accesslog_weixin(self):
        # TODO  'sync_member_personal_accesslog_weixin'
        db = self.env['bn.db.connect'].search([('store_code', '=', 'bncard')])
        mem_list = self.get_personal_accesslog_weixin(Bnc_Mysql_SQLCa(db[0]))
        i = 0
        for (wxid, mobile, unionid, openid, login_time, update_time,
             bnc_login_time, stamp) in mem_list:

            print i, len(mem_list), mobile
            i = i + 1

            member = self.env['bnc.member'].search([('strPhone', '=', mobile)])
            if member:
                bnc_member_id = member[0].id
                _logger.info("sync_member_personal_accesslog_weixin':" +
                             str(i) + "/" + str(len(mem_list)) +
                             " the phones is =>  " + mobile)
                member.write({'login_time': login_time})
            else:
                bnc_member_id = None
            val = {
                'strWxit': wxid,
                'unionid': unionid,
                'openid': openid,
                'login_time': bnc_login_time,
                'timestamp': stamp,
                'belong_bnc_member': bnc_member_id,
            }
            mem_c = self.env['bnc.member.accesslog'].search([('strWxit', '=',
                                                              wxid)])
            if mem_c:
                mem_c.write(val)
            else:
                self.env['bnc.member.accesslog'].create(val)

        return True