feat(app): 接入金币充值与会员商品下单
This commit is contained in:
1 parent
ec2db6842e
commit
730e38622f
21 files changed
+1325
-1
No files matched your search
@@ -0,0 +1,25 @@
|
||||
// Author: fruit.com.cn
|
||||
|
||||
import '../models/order.dart';
|
||||
import '../models/product.dart';
|
||||
import '../remote/commerce_api.dart';
|
||||
|
||||
/// 商品与订单来源:充值页、会员页共用。
|
||||
abstract interface class StoreRepository {
|
||||
Future<List<AppProduct>> fetchProducts({String? type});
|
||||
|
||||
Future<AppOrder> createOrder(String productId);
|
||||
}
|
||||
|
||||
class HttpStoreRepository implements StoreRepository {
|
||||
const HttpStoreRepository(this._api);
|
||||
|
||||
final CommerceApi _api;
|
||||
|
||||
@override
|
||||
Future<List<AppProduct>> fetchProducts({String? type}) =>
|
||||
_api.products(type: type);
|
||||
|
||||
@override
|
||||
Future<AppOrder> createOrder(String productId) => _api.createOrder(productId);
|
||||
}
|
||||
Reference in new issue
Block a user