没有不值得去解决的问题,也没有不值得去学习的技术!

International Phone Number Support for UCenter and ShopNC With Ronglianyun and Yunpian

Figure 13: ajax validation: whether it is a Taiwan mobile number

1. Platform – Settings – Email Settings – Message Templates: Enable Traditional Chinese support for template content (mail_msg_temlates: Email templates, add template ID field (APP Yuntongxun SMS template): temp_id_app, add Traditional Chinese field (Traditional Chinese SMS template content (Yunpian SMS template)): content_zh_tw), as shown in Figure 1:

Add Traditional Chinese field (Traditional Chinese SMS template content (Yunpian SMS template)): content_zh_tw
Add Traditional Chinese field (Traditional Chinese SMS template content (Yunpian SMS template)): content_zh_tw

2. Implementation of the new email template feature, as shown in Figure 2;

Implementation of the new email template feature
Implementation of the new email template feature

3. Email template data, as shown in Figures 3, 4, and 5:
(1) Yiguantong mobile registration: 96255 (Yiguantong) 93122 (Yiguantong APP)
【医管通】您正在注册医管通帐号,验证码{1},请在{2}分钟内按页面提示提交验证码。 Note: Yuntongxun SMS template
【医管通】您正在註冊醫管通帳號,驗證碼#code#,請在#minute#分鐘內按頁面提示提交驗證碼。 Note: Yunpian SMS template

【{$site_name}】您正在注册医管通帐号,验证码{$verify_code},请在{$minute}分钟内按页面提示提交验证码。 Note: Template content in the database
【{$site_name}】您正在註冊醫管通帳號,驗證碼{$verify_code},請在{$minute}分鐘內按頁面提示提交驗證碼。 Note: Traditional Chinese SMS template content in the database (Yunpian SMS template)

Figure 3: 96255 (Yiguantong), Yuntongxun SMS template
Figure 3: 96255 (Yiguantong), Yuntongxun SMS template
Figure 4: (Yiguantong), Yunpian SMS template
Figure 4: (Yiguantong), Yunpian SMS template

4. Platform – Settings – Region Settings: Edit region to enable editing of the international region number prefix (area: add field for international region number prefix to the region table: area_mobile), as shown in Figure 5:

Chinese Mainland +86 0
Taiwan +886 32

Alibaba Cloud
ALTER TABLE `trade_area` ADD COLUMN `area_mobile` varchar(5) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT ‘国际地区号码前缀’ AFTER `area_region`;

Edit region to enable editing of the international region number prefix (area: add field for international region number prefix to the region table: area_mobile)
Edit region to enable editing of the international region number prefix (area: add field for international region number prefix to the region table: area_mobile)

5. trade.service.ygt.cm: Implement fetching the list of international region names and number prefixes, and fetching the international region name and number prefix based on the region ID.

http://trade.service.ygt.cm/area/get-area-mobile

http://trade.service.ygt.cm/area/get-area-mobile?area_id=32

6. UCenter: Implement editable user mobile and area_id, as shown in Figure 6:
(1) Add an international region ID field to the user table: area_id. The combination of mobile and area_id is unique.
ALTER TABLE `kcuc_members` ADD `area_id` INT(11) UNSIGNED NOT NULL DEFAULT ‘0’ COMMENT ‘国家区号ID’ AFTER `mobile`;
(2) http://kcuc.ygt.cm/ Passport backend: Add and edit user Mobile, supporting selection from the list of international region names and number prefixes.
User Management – Add User, Edit User
(3) User management is sorted in descending order by user ID.
(4) User Management – Search User: Supports selection of country calling code.

Figure 6: Internationalization currently only supports Chinese Mainland and Taiwan
Figure 6: Internationalization currently only supports Chinese Mainland and Taiwan

7. UCenter client user interface: Implement displaying and editing user mobile and area_id, as shown in Figure 7:
(1) Check Mobile address (uc_user_checkmobile)
(2) User registration (uc_user_register): Mobile supports selection of country calling code.
(3) Get user data (uc_get_user)
(4) Update user profile based on user ID (uc_user_uidedit): Mobile supports selection of country calling code.
(5) API interface updates user profile: Mobile supports country calling code.
(6) Business System – Backend – Platform – Member – Member Management – Member Management, Add, Edit Member
ALTER TABLE `trade_member` ADD `member_area_mobile` INT(11) UNSIGNED NOT NULL DEFAULT ‘0’ COMMENT ‘国家区号ID’ AFTER `member_email_bind`;
(7) Business System – Backend – Mall – Member – Member Management – Add, Edit Member

Figure 7: UCenter client user interface implements displaying and editing user mobile and area_id
Figure 7: UCenter client user interface implements displaying and editing user mobile and area_id

8. Mobile registration: Mobile supports selection of country calling code.
(1) Add an international region ID field to the mobile SMS log table: log_area_mobile. The combination of log_area_mobile and log_phone is unique, as shown in Figure 8:
ALTER TABLE `trade_sms_log` ADD `log_area_mobile` INT(11) UNSIGNED NOT NULL DEFAULT ‘0’ COMMENT ‘国家区号ID’ AFTER `log_id`;

Figure 8: Add international region ID field to the mobile SMS log table
Figure 8: Add international region ID field to the mobile SMS log table

(2) SMS sending supports Chinese Mainland and Taiwan (based on Yuntongxun and Yunpian respectively), as shown in Figures 9, 10, and 11:

Figure 9: Implemented Yunpian namespace and autoloading, and called the service layer: get country calling code list
Figure 9: Implemented Yunpian namespace and autoloading, and called the service layer: get country calling code list
Figure 10: Selection of SMS service provider
Figure 10: Selection of SMS service provider
Figure 11: Send template SMS, Ronglian Cloud; Send single SMS, Yunpian (smart match)
Figure 11: Send template SMS, Ronglian Cloud; Send single SMS, Yunpian (smart match)

(3) Implementation of mobile registration, supporting internationalization.

Figure 12: ajax validation: whether it is an overseas mobile number
Figure 12: ajax validation: whether it is an overseas mobile number
Figure 13: ajax validation: whether it is a Taiwan mobile number
Figure 13: ajax validation: whether it is a Taiwan mobile number
Figure 14: ajax validation: whether the mobile number has already been registered
Figure 14: ajax validation: whether the mobile number has already been registered
Figure 15: Ronglian Cloud SMS
Figure 15: Ronglian Cloud SMS
Figure 16: SMS sent by Yunpian to Taiwan mobile number, Traditional Chinese
Figure 16: SMS sent by Yunpian to Taiwan mobile number, Traditional Chinese

9. ShopNC backend member list, as shown in Figure 17:

Figure 17: ShopNC backend member list
Figure 17: ShopNC backend member list

关于作者 · 持续学习与技术实践

我是一名拥有 15 年以上开发经验的技术从业者,自 2013 年起持续运营个人技术博客,记录工作与个人项目中遇到的真实问题,以及解决问题过程中的探索、实践和思考。

除了技术写作,我也在持续开发和维护自己的独立项目,探索新技术和新工具在实际场景中的应用。我始终相信,没有不值得去解决的问题,也没有不值得去学习的技术。

如果这篇文章对你有所帮助,欢迎浏览博客中的其他文章,也欢迎交流技术经验与想法。

关于我  ·  GitHub  ·  邮件联系