Explorar o código

第一条默认地址

lrf %!s(int64=2) %!d(string=hai) anos
pai
achega
4913aecb76
Modificáronse 1 ficheiros con 4 adicións e 1 borrados
  1. 4 1
      app/service/user/address.js

+ 4 - 1
app/service/user/address.js

@@ -18,7 +18,10 @@ class AddressService extends CrudService {
     if (is_default !== this.defaultValue) await this.toDefault({ id: data._id });
     return data;
   }
-
+  /**
+   * 如果数据是第一条数据,则地址为默认地址
+   * @param {Object} data 地址参数
+   */
   async beforeCreate(data) {
     const { customer } = data;
     const num = await this.model.count({ customer });